mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 10:12:24 +00:00
lxc-execute: actually exit with the status of the spawned task
Now that we have things propagated through init and liblxc correctly, at least in non-daemon mode, we can exit with the actual exit status of the task, instead of always succeeding, which is not so helpful. Signed-off-by: Tycho Andersen <tycho@tycho.ws>
This commit is contained in:
parent
eb8085399c
commit
f9eff95053
@ -213,14 +213,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
c->daemonize = my_args.daemonize == 1;
|
c->daemonize = my_args.daemonize == 1;
|
||||||
bret = c->start(c, 1, my_args.argv);
|
bret = c->start(c, 1, my_args.argv);
|
||||||
if (c->daemonize)
|
|
||||||
ret = EXIT_SUCCESS;
|
|
||||||
else
|
|
||||||
ret = c->error_num;
|
|
||||||
lxc_container_put(c);
|
lxc_container_put(c);
|
||||||
if (!bret) {
|
if (!bret) {
|
||||||
fprintf(stderr, "Failed run an application inside container\n");
|
fprintf(stderr, "Failed run an application inside container\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
exit(ret);
|
if (c->daemonize)
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
else {
|
||||||
|
if (WIFEXITED(c->error_num)) {
|
||||||
|
exit(WEXITSTATUS(c->error_num));
|
||||||
|
} else {
|
||||||
|
/* Try to die with the same signal the task did. */
|
||||||
|
kill(0, WTERMSIG(c->error_num));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user