Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > 'ruby' exit code 32512

Reply
Thread Tools

'ruby' exit code 32512

 
 
jacob@asperasoft.com
Guest
Posts: n/a
 
      02-05-2007
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

 
Reply With Quote
 
 
 
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      02-05-2007
On Tue, 6 Feb 2007 http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

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


nothing to do with ruby

man 2 wait
...

WEXITSTATUS(status)

evaluates to the least significant eight bits of the return code of the child
which terminated, which may have been set as the argument to a call to
exit() or _exit() or as the argument for a return statement in the main
program. This macro can only be evaluated if WIFEXITED returned true.

...

the exit staus in unix is stored in only the first byte of the exit status
word. and

32512 => 11111110 0000000
^
^
^
exit status


this is one of the beautiful things about windows being non-posix.



-a
--
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama

 
Reply With Quote
 
 
 
 
Mike Fletcher
Guest
Posts: n/a
 
      02-05-2007
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-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I get the exit code "n" passed to sys.exit(n) ? Yujo Python 2 04-10-2007 08:35 PM
Exit code of a batch (using exit /B) Joe Smith Java 4 11-08-2006 12:25 PM
Code to Exit Web App and Exit Internet Explorer =?Utf-8?B?U2FuZHk=?= ASP .Net 7 08-05-2005 01:55 AM
exit after process exit ajikoe@gmail.com Python 2 05-31-2005 08:11 PM
What's the difference of return 0; exit(0);exit(1) QQ C Programming 5 05-10-2005 10:11 PM



Advertisments