Bob Showalter
12/15/2005 9:44:00 PM
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.