[lxc-devel] lxc-attach exit code
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Jul 16 14:29:50 UTC 2014
Currently c->attach() is documented to return -1 on failure. Since we
want our api to be stable, i'd prefer not to change that. How about if
we safe the actual exit status in the container object so that you can
retrieve it? That feels very thread-unsafe though.
So maybe changing the exit value is ok... Other thoughts?
Quoting Ashvin Goel (ashvin.goel at gmail.com):
> Hi,
>
> lxc-attach returns the exit code of the program it ran when the program
> exits normally (when WIFEXITED returns true, see below). However, when a
> program is killed/signaled, lxc-attach returns 1. So currently, it is not
> possible to determine whether the program was signaled (because
> WEXITSTATUS(ret) may be 1). I was wondering why the exit code of the child
> program is not returned by lxc-attach in all cases when ret > 0.
>
> Attached snippet:
>
> ret = lxc_wait_for_pid_status(pid);
> if (ret < 0)
> return 1;
>
> if (WIFEXITED(ret))
> return WEXITSTATUS(ret);
>
> return 1;
>
>
>
> Thanks
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list