[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

'ruby' exit code 32512

jacob

2/5/2007 8:21:00 PM

Hi, I was having trouble with what seems to be an inconsistency in
ruby exit codes. I can explain this best with examples:

On Windows XP, the command:
ruby -e 'exit(32512)' || echo hi

yeilds output (as it seems it should):
hi

whereas on Mac OS X Darwin, the same command does not output anything
(where I expect it to output "hi"). Ruby on OS X behaves as I would
expect if other exit codes are used.

"ruby -v" for the windows computer: ruby 1.8.4 (2006-04-14) [i386-
mswin32]
"ruby -v" for the mac computer: ruby 1.8.2 (2004-12-25) [universal-
darwin8.0]


Thank you ahead of time for help in this matter,

Jacob

2 Answers

Ara.T.Howard

2/5/2007 8:50:00 PM

0

Mike Fletcher

2/5/2007 8:53:00 PM

0

unknown wrote:
> Hi, I was having trouble with what seems to be an inconsistency in
> ruby exit codes. I can explain this best with examples:
>
> On Windows XP, the command:
> ruby -e 'exit(32512)' || echo hi
>
> yeilds output (as it seems it should):
> hi
>
> whereas on Mac OS X Darwin, the same command does not output anything
> (where I expect it to output "hi"). Ruby on OS X behaves as I would
> expect if other exit codes are used.

Not sure about Windows, but a quick glance through Stevens' _Advanced
Programming in the UNIX Environment_ reinforces my off-the-cuff
recollection that POSIX doesn't specify more than allowing an 8-bit exit
status code to make it through. See the wait(2) manual page for the
documentation for the WEXITSTATUS(status) macro, which on both OS X and
Linux specifically mention 8-bits.

--
Posted via http://www.ruby-....