Skip to content

Instantly share code, notes, and snippets.

@tt
Created October 10, 2013 17:50
Show Gist options
  • Save tt/6922599 to your computer and use it in GitHub Desktop.
Save tt/6922599 to your computer and use it in GitHub Desktop.
% chruby 1.9.2
% echo "pid = Process.spawn('sh -c \"exit 0\"'); _, status = Process.wait2(pid); warn status.inspect; warn status == 0; warn status.exitstatus == 0" | ruby
#<Process::Status: pid 50482 exit 0>
true
true
% echo "pid = Process.spawn('sh -c \"exit 0\"'); _, status = Process.wait2(pid); warn status.inspect; warn status == 1; warn status.exitstatus == 1" | ruby
#<Process::Status: pid 50454 exit 0>
false
false
% echo "pid = Process.spawn('sh -c \"exit 1\"'); _, status = Process.wait2(pid); warn status.inspect; warn status == 0; warn status.exitstatus == 0" | ruby
#<Process::Status: pid 50327 exit 1>
false
false
% echo "pid = Process.spawn('sh -c \"exit 1\"'); _, status = Process.wait2(pid); warn status.inspect; warn status == 1; warn status.exitstatus == 1" | ruby
#<Process::Status: pid 50355 exit 1>
false
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment