src: fix exit code check on linux

This commit is contained in:
Shuanglei Tao
2019-09-15 19:06:47 +08:00
parent 5381d0f825
commit 62844c2509
3 changed files with 20 additions and 6 deletions

View File

@@ -186,6 +186,14 @@ sigchld_handler() {
int status = wait_proc(-1, &pid);
if (pid > 0) {
lwsl_notice("process exited with code %d, pid: %d\n", status, pid);
struct tty_client *iterator;
LIST_FOREACH(iterator, &server->clients, list) {
if (iterator->pid == pid) {
iterator->running = false;
iterator->exit_status = status;
break;
}
}
}
}