lua-users home
lua-l archive

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


Hey folks,

Instead of returning the shell's exit status, os.execute
returns that exit status multiplied by 256 (i.e., shifted
over one byte).  I assume that's not intentional.

As you can see below, I duplicated it with
Linux versus BSD and Lua 5.0.2 versus Lua 5.1 work2.  I
eyeballed the source but couldn't see what was going wrong.

PINE abrown 1 ~> uname -a
Linux PINE 2.4.20-28.9 #1 Thu Dec 18 13:45:22 EST 2003 i686 i686 i386 GNU/Linux
PINE abrown 1 ~> gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with:
../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checki
ng --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
PINE abrown 1 ~> lua -v -e 'print(os.execute("false"))'
Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio
256
PINE abrown 1 ~> ./src/lua-5.1-work2/bin/lua -v -e 'print(os.execute("false"))'
Lua 5.1 (work2)  Copyright (C) 1994-2004 Tecgraf, PUC-Rio
256
PINE abrown 1 ~>

m-net:~ 0$ uname -a
FreeBSD m-net.arbornet.org 4.6.2-RELEASE-p26 FreeBSD 4.6.2-RELEASE-p26 #7: Sun Oct  5 00:39:40 EDT 2003
styles@m-net.arbornet.org:/source/stable/src/sys/compile/MNET  i386
m-net:~ 1$ gcc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release) [FreeBSD]
m-net:~ 1$ lua -v -e 'print(os.execute("false"))'
Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio
256
m-net:~ 1$

-- 
Aaron