rasjani
rasjani

Reputation: 7970

Ruby backtick'd code exits with 136?

I have a ruby script that executes another ruby script via backticks. Like this:

output = `#{name}/#{sccript} --list`

In certain scenarios (I'm running this during build time of a binary package and there are multiple instances of same script running) this will fail.

output is 0 lenght and $? is set to 136.

Any ideas what would be causing this?

Upvotes: 0

Views: 3388

Answers (2)

Ken Bloom
Ken Bloom

Reputation: 58810

Exit code 136 is in the range 129-255, which represent jobs terminated by Unix signals.

To find out which signal, subtract 128, and you find its signal 8: SIGFPE. One possible cause might be integer division by zero in a C program.

Upvotes: 11

Jed Schneider
Jed Schneider

Reputation: 14679

backticks will always return whatever the stdout of the call will be, if you just want true or false, use system:

ruby-1.9.2-p0 :009 > \`echo "hello"\`
=> "hello\n"   
ruby-1.9.2-p0 :010 > system("echo 'hello'")   
hello 
=> true

so, to answer your question '136' is whatever your script is returning

Upvotes: 0

Related Questions