Ruby - display backtick output on console

Viewed 647

In Ruby I'm using backticks to execute (many) shell commands. How do I get the shell command output displayed on the console?

A bit more detail. If I run an (ansible) command like the following, I get lots of scrolling output on the console:

% ansible-playbook config.yml -e foo=bar -e baz=qux

PLAY [base setup] **************************************************************

TASK [setup] *******************************************************************
ok: [10.99.66.210]

... etc, etc

However if I execute the same command from Ruby (using backticks) I don't see any output on the console:

# cmd = ansible-playbook config.yml -e foo=bar -e baz=qux
`#{cmd}`

Which is unfortunate, as I'd like to see the output in order to debug. I could redirect the output from the Ruby script to a (tailed) log file, however I want to see the output as it happens.

1 Answers
Related