diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-02-01 03:56:32 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-02-01 03:56:32 +0100 |
commit | 430cd0cf13ffda3d9850f7a17f25bed51233ad63 (patch) | |
tree | 7ae26e13623b595e46f4f170f671ae62b2ce9266 /src | |
parent | 0d7ce5264e8c87c522a93172c944541bb205b9d5 (diff) |
Reap child in exec program async
Diffstat (limited to 'src')
-rw-r--r-- | src/Program.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Program.cpp b/src/Program.cpp index d9927af..33f5cd0 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -217,8 +217,6 @@ int exec_program_async(const char **args, pid_t *result_process_id) { setsid(); signal(SIGHUP, SIG_IGN); - // TODO: Still creates zombie??? find a fix! - // Daemonize child to make the parent the init process which will reap the zombie child pid_t second_child = fork(); if(second_child == 0) { // child @@ -232,6 +230,8 @@ int exec_program_async(const char **args, pid_t *result_process_id) { } else { /* parent */ if(result_process_id) *result_process_id = pid; + + waitpid(pid, nullptr, 0); } return 0; } |