I have a bunch of ruby ββsystem calls, such as the following, and I want to check their exit codes at the same time so that my script exits if this command fails.
system("VBoxManage createvm --name test1") system("ruby test.rb")
I need something like
system("VBoxManage createvm --name test1", 0) <- where the second parameter checks the exit code and confirms that this system call was successful, and if not, it will cause an error or do something like that.
Is this even possible?
I tried something about this, and it didn't work either.
system("ruby test.rb") system("echo $?")
or
`ruby test.rb` exit_code = `echo $?` if exit_code != 0 raise 'Exit code is not zero' end
ruby command exit-code exit
user1530318 Sep 10 '13 at 20:22 2013-09-10 20:22
source share