Re: adding errorcodes on luajit.exe failures

  • From: Stefan Hett <stefan@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 13 Oct 2014 14:37:51 +0200

Hi Mike,

thanks for the fast reply and sry for my late response (got distracted from this issue the past weeks).

Of course u're absolutely right. I obviously mistook the pmain-return value for the actual status return value. So everything is fine on LuaJIT's end and the errorlevel correctly shows a problem as well as records the error in the errorchannel.

The issue was actually on our side (our script not correctly checking the errorlevel and not redirecting the error-channel, but rather only checking/redirecting the standard output channel).

So sorry for the noise.

Regards,
Stefan
Stefan Hett wrote:
I see from the code-base that in case of an error LuaJIT (aka:
pmain) doesn't return any errorcodes at all.
That's not true. A simple test could have shown you that before
posting. If you throw an error to the top level or use os.exit(n),
it *does* set the error code (POSIX shell examples):

$ luajit -e ''; echo $?
0

$ luajit -e 'error("foo")' 2>/dev/null; echo $?
1

$ luajit -e 'os.exit(42)'; echo $?
42

--Mike




Other related posts: