System() failed with $?==32512

Hi all,

I have a program too large to post a code snippet, and my system()
call does not work. It returns false, and the $? variable is set to
32512. Looking through various errno.h files, I couldn't find a
corresponding number. Ugh!

I have a little hello world program that runs system() just fine.
Anyone know how to interprest the 32512? Anyone know how to find an
error message in English? Any other ideas to narrow the root cause
scope of this problem?

Thanks

SteveT

Steve Litt
http://www.troubleshooters.com
slitt@troubleshooters.com

Dooohhh! My ruby program, which is a menu system, first creates
script files and then runs them using system(). This is actually a
Ruby rewrite of my UMENU program.

Anyway, when coding it to construct the script I forgot to have it
create the shebang line (#!/bin/bash). Although such bash scripts
work just fine without the shebang when run from bash itself, of
course they fail when run via system() in Ruby.

I solved this by creating a short program that failed.

SteveT

Steve Litt

slitt@troubleshooters.com

···

On Thursday 15 December 2005 01:05 pm, Steve Litt wrote:

Hi all,

I have a program too large to post a code snippet, and my
system() call does not work. It returns false, and the $?
variable is set to 32512. Looking through various errno.h files,
I couldn't find a corresponding number. Ugh!

I have a little hello world program that runs system() just fine.
Anyone know how to interprest the 32512? Anyone know how to find
an error message in English? Any other ideas to narrow the root
cause scope of this problem?

I have a little hello world program that runs system() just fine.
Anyone know how to interprest the 32512? Anyone know how to find an
error message in English? Any other ideas to narrow the root cause
scope of this problem?

The exit codes are set by the program that you were called with
system. For example, on windows:

irb(main):062:0> system "cmd /c exit 3"; puts $?.inspect
#<Process::Status: pid=1100,exited(3)>
=> nil
irb(main):063:0> system "cmd /c exit 33"; puts $?.inspect
#<Process::Status: pid=1472,exited(33)>
=> nil

There is no universal key to error codes. The first step to figuring
it out is to identify the program you were tying to call. Then search
that program's documentation.

Steve Litt wrote:

···

On Thursday 15 December 2005 01:05 pm, Steve Litt wrote:

Hi all,

I have a program too large to post a code snippet, and my
system() call does not work. It returns false, and the $?
variable is set to 32512. Looking through various errno.h files,
I couldn't find a corresponding number. Ugh!

I have a little hello world program that runs system() just fine.
Anyone know how to interprest the 32512? Anyone know how to find
an error message in English? Any other ideas to narrow the root
cause scope of this problem?

Dooohhh! My ruby program, which is a menu system, first creates script files and then runs them using system(). This is actually a Ruby rewrite of my UMENU program.

Anyway, when coding it to construct the script I forgot to have it create the shebang line (#!/bin/bash). Although such bash scripts work just fine without the shebang when run from bash itself, of course they fail when run via system() in Ruby.

I solved this by creating a short program that failed.

Note that 32512 is 127 << 8.

$? is actually a Process::Status object (in Ruby 1.8+)

The exit status is 127 and is coming from /bin/sh not being able to find the program to execute.