[lxc-devel] lxc-attach exit code

Ashvin Goel ashvin.goel at gmail.com
Thu Jul 17 15:02:07 UTC 2014


It turns out that the exit code issue appears to be more complicated
because of how signals are encoded by wait and the interactions with the
shell. See the following:
http://www.ogf.org/pipermail/drmaa-wg/2008-November/000965.html

If we return "ret" when the child process is signaled, then a "kill -1
childpid" will return a value of 1, and so it will not be possible to
distinguish that with the child process returning with exit code 1.
Alternatively, we could add 128 to the return value , which is what the
shell does, when a child process is signaled. However, I don't know if that
would work for all shells (I tried bash, and bash does return the exit code
correctly, i.e., unmodified). Another option is to simply return a value
different from 1 (e.g., 2), to indicate that the child process was
signaled. This is similar to the way grep returns different exit error
codes depending on whether the pattern was not found or the file was not
found.

Thanks
Ashvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140717/c2eebf55/attachment.html>


More information about the lxc-devel mailing list