[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: os.exit()/os.execute() behaviour (Lua 5.1)
- From: Andres Perera <andres.p@...>
- Date: Fri, 17 May 2013 09:09:55 -0430
On Fri, May 17, 2013 at 8:36 AM, Thijs Schreijer
> I ran into some issues testing for os.execute() results. So I wrote some
> test code and executed it on Windows and Ubuntu 10. The code is run twice,
> once running os.execute, once with penlights execute method.
> Test code:
> The results (see below) are what I expected for Windows. But on Ubuntu, I
> can’t explain it.
> 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.
In Lua 5.1 on POSIX hosts, it is a bitmask representing a process
status as operated with waitpid().
(6400 >> 8) & 0xFF = 25
This matches my OS'es deffinition of WEXITSTATUS(), which happens to
coincide with Ubuntu's in this case.