lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 17.05.2013 15:06, Thijs Schreijer wrote:

> The exitcodes are supposed to be between 0 and 255. So the os.exit(-5)
> and os.exit(400) are out of range, but the valid test; os.exit(25) also
> gives me a return value in os.execute() of 6400.
> 
> The windows one (further down below) just handles any numeric argument,
> also outside the 0-255 range.
> 
> Any clues to why this is happening?

http://stackoverflow.com/questions/1101957/are-there-any-standard-exit-status-codes-in-linux

"8 bits of the return code and 8 bits of the number of the killing
signal are mixed into a single value on the return from wait(2) & co.."

> testing os.exit(25) exitcode (lua _exitcode.lua 25)
> 
>   #:1
> 
>   1:    6400

$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
obase=2
25
11001
6400
1100100000000


Regards,
	miko