Various Ways to Run Shell Commands in Ruby

Do you really need to run a bash command? Can you do this task in pure Ruby, either with the core classes or the standard library? e.g. If you want to copy/move a file or directory, check out FileUtils library.Are you running a command which was constructed with input from the users?Are you running the command just for its side effects, or are you interested in the standard output (stdout)? Will you need standard error (stderr), as well?Will you need the result codes?How large is the result set? Do you want to stream the output while the command is still running in the background? or do you want to fetch everything at once and hold it in memory?Do you want to run the command as a separate process and access that process as a Ruby object? Do you want to kill that process later, if it's taking too long?.
Various Ways to Run Shell Commands in Ruby #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/various-ways-to-run-shell-commands-in-ruby

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles