apparently that's important :p
This commit is contained in:
parent
1c235447e2
commit
6a3e288d74
|
@ -49,7 +49,7 @@ namespace nanosm {
|
||||||
for(usize i = 0; i < exp.words.size(); ++i)
|
for(usize i = 0; i < exp.words.size(); ++i)
|
||||||
argv[i] = exp.words[i].data();
|
argv[i] = exp.words[i].data();
|
||||||
|
|
||||||
execvp(exp.words[0].data(), argv.data());
|
exit(execvp(exp.words[0].data(), argv.data()));
|
||||||
} else {
|
} else {
|
||||||
// Parent: monitor the pidfd by adding ourselves to the event loop now
|
// Parent: monitor the pidfd by adding ourselves to the event loop now
|
||||||
eventLoop.AddObject(IoObject::Ptr(shared_from_this()));
|
eventLoop.AddObject(IoObject::Ptr(shared_from_this()));
|
||||||
|
@ -60,8 +60,8 @@ namespace nanosm {
|
||||||
|
|
||||||
void Process::OnReady(int eventMask) {
|
void Process::OnReady(int eventMask) {
|
||||||
// In our case, any readiness signaled by the pidfd means the process exited
|
// In our case, any readiness signaled by the pidfd means the process exited
|
||||||
// so this will never block (or really, wait).
|
// so this will never block (or really, wait). But in the case that it does
|
||||||
waitid(P_PIDFD, pidFd, &siginfo, WNOHANG);
|
auto res = waitid(P_PIDFD, pidFd, &siginfo, WNOHANG | WEXITED);
|
||||||
|
|
||||||
// Post a callback to call the user's exit callback (if one exists)
|
// Post a callback to call the user's exit callback (if one exists)
|
||||||
eventLoop.Post([self = shared_from_this()]() {
|
eventLoop.Post([self = shared_from_this()]() {
|
||||||
|
|
Loading…
Reference in New Issue