I have a bunch of system calls in ruby such as the following and I want to check their exit codes simultaneously so that my script exits out if that command fails.
From the documentation:
system returns
trueif the command gives zero exit status,falsefor non zero exit status. Returnsnilif command execution fails.
system("unknown command") #=> nil
system("echo foo") #=> true
system("echo foo | grep bar") #=> false
Furthermore
An error status is available in
$?.
system("VBoxManage createvm --invalid-option")
$? #=> #
$?.exitstatus #=> 2