Open dimlio opened 1 year ago
Agree, this is a bit irritating - it's a bit unclear how I can trap signals easily in the top level command plugin portably though, needs investigation.
I did a try on this, but it seems even with --disable-sandbox
I can't send a signal to the child process, with sandbox I get EPERM
and with sandbox disabled I get ESRCH
(with the correct pid provided).
I basically did this (in benchmark command plugin, command tool and benchmark runner all the way):
var childPid: pid_t = 0
...
_ = signal(SIGINT, callback)
...
typealias SignalCallbackType = @convention(c) (Int32) -> Void
let callback: SignalCallbackType = { signalNumber in
let result = kill(childPid, SIGINT)
print("\(childPid) Errno \(errno), result \(result)")
exit(0)
}
I can get a printout so the signal handler is correctly installed, I just can't kill the child processes.
I filed this case too:
Now when a benchmark hangs and I terminate it with Ctrl-C spawned processes remain running.