lua-users home
lua-l archive

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


On Fri, May 17, 2013 at 12:16 PM, Gyepi SAM <self-lua@gyepi.com> wrote:
> We need to make a distinction here between wait() and system().
> Everything written here applies to wait, but does differ for system()
> because system calls "/bin/sh -c" (or the moral equivalent) and returns
> the shell's exit code. When a process terminates normally, the shell returns
> its exit code. However, when the process is terminated by a signal, it
> returns 128 + the signal number.

Well, not exactly. Everything about wait() does apply to system(),
it's just that the intervening shell layer may result in a different
status returned than would if you had called the process directly.

So if the invoked process segfaults, then the shell translates that
into an exit code (often 139) with no signals. But if the shell
segfaults, you'll still get the signal (often 11) as you would with
wait().