Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Created October 19, 2012 20:17
Show Gist options
  • Save wolfeidau/3920449 to your computer and use it in GitHub Desktop.
Save wolfeidau/3920449 to your computer and use it in GitHub Desktop.
Output of Mixlib::ShellOut showing normal ping vs riak ping stdout, stderr differences

In the following output you can see execution of the OSX ping command, the pingc.run_command is where we can see the output of a failed ping.

1.9.3p194 :009 > pingc = Mixlib::ShellOut.new("ping", "beer.invalid")
 => <Mixlib::ShellOut#70097041980820: command: '["ping", "beer.invalid"]' process_status: nil stdout: '' stderr: '' child_pid: nil environment: {"LC_ALL"=>"C"} timeout: 600 user:  group:  working_dir:  > 
1.9.3p194 :010 > pingc.run_command
 => <Mixlib::ShellOut#70097041980820: command: '["ping", "beer.invalid"]' 
process_status: #<Process::Status: pid 87108 exit 68> 
stdout: '' 
stderr: 'ping: cannot resolve beer.invalid: Unknown host' 
child_pid: 87108 environment: {"LC_ALL"=>"C"} timeout: 600 user:  group:  working_dir:  > 

Next is the output of riak ping, again we have to entries, and in this sample it is clear that the riak one outputs the error on stdout rather than stderr.

1.9.3p194 :017 > pingc = Mixlib::ShellOut.new("riak", "ping")
 => <Mixlib::ShellOut#70097037345480: command: '["riak", "ping"]' process_status: nil stdout: '' stderr: '' child_pid: nil environment: {"LC_ALL"=>"C"} timeout: 600 user:  group:  working_dir:  > 
1.9.3p194 :018 > pingc.run_command
 => <Mixlib::ShellOut#70097037345480: command: '["riak", "ping"]' 
process_status: #<Process::Status: pid 87221 exit 1> 
stdout: 'Node '[email protected]' not responding to pings.' 
stderr: '' 
child_pid: 87221 environment: {"LC_ALL"=>"C"} timeout: 600 user:  group:  working_dir:  > 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment