From 6a3e288d748910ea94347463d1d7527c4e0d9881 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Fri, 2 Feb 2024 07:26:45 -0500 Subject: [PATCH] apparently that's important :p --- src/Process.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Process.cpp b/src/Process.cpp index 265fe46..157d8f8 100644 --- a/src/Process.cpp +++ b/src/Process.cpp @@ -49,7 +49,7 @@ namespace nanosm { for(usize i = 0; i < exp.words.size(); ++i) argv[i] = exp.words[i].data(); - execvp(exp.words[0].data(), argv.data()); + exit(execvp(exp.words[0].data(), argv.data())); } else { // Parent: monitor the pidfd by adding ourselves to the event loop now eventLoop.AddObject(IoObject::Ptr(shared_from_this())); @@ -60,8 +60,8 @@ namespace nanosm { void Process::OnReady(int eventMask) { // In our case, any readiness signaled by the pidfd means the process exited - // so this will never block (or really, wait). - waitid(P_PIDFD, pidFd, &siginfo, WNOHANG); + // so this will never block (or really, wait). But in the case that it does + auto res = waitid(P_PIDFD, pidFd, &siginfo, WNOHANG | WEXITED); // Post a callback to call the user's exit callback (if one exists) eventLoop.Post([self = shared_from_this()]() {