apparently that's important :p

This commit is contained in:
Lily Tsuru 2024-02-02 07:26:45 -05:00
parent 1c235447e2
commit 6a3e288d74
1 changed files with 3 additions and 3 deletions

View File

@ -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()]() {