Forum: Ruby system() failed with $?==32512

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1b62a85b59ccab03b84ee5ec378f75b4?d=identicon&s=25 Steve Litt (Guest)
on 2005-12-15 19:07
(Received via mailing list)
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
1b62a85b59ccab03b84ee5ec378f75b4?d=identicon&s=25 Steve Litt (Guest)
on 2005-12-15 19:22
(Received via mailing list)
On Thursday 15 December 2005 01:05 pm, Steve Litt wrote:
> 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.

SteveT

Steve Litt
http://www.troubleshooters.com
slitt@troubleshooters.com
Ddbfebb47432f6599da361df6a135c7c?d=identicon&s=25 Adam Shelly (Guest)
on 2005-12-15 22:29
(Received via mailing list)
> 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.
123320fdc17940dfc8e365edb48fbff2?d=identicon&s=25 Bob Showalter (Guest)
on 2005-12-15 22:45
(Received via mailing list)
Steve Litt wrote:
>>Anyone know how to interprest the 32512? Anyone know how to find
> 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.
This topic is locked and can not be replied to.