Closed j-mie6 closed 1 month ago
@lihaoyi other than the documentation for ProcessLike
, and any additional tests, this seems pretty much good to go. I have a couple of questions above that it would be nice to discuss. Can I get a CI run please?
I think this looks good.
1000 seems a bit long for a grace period; what do you think about something shorter, like 50ms or 100ms? I don't want to change the behavior too much from the status quo, which terminates the process immediately
I think this looks good.
1000 seems a bit long for a grace period; what do you think about something shorter, like 50ms or 100ms? I don't want to change the behavior too much from the status quo, which terminates the process immediately
Sure, 100ms is fine. Do note that it's unlikely to wait the full 1000ms anyway, because SIGTERM exits fast unless there is cleanup to do or the process ignores it anyway.
I think this looks good. @j-mie6 if you're happy with too it I'll merge it and cut a release
I've patched up the documentation now, so I'm happy to ship it if you are :)
Fixes #284.
The idea is to introduce a new flag to both
os.proc.call
andos.ProcGroup.call
, as well as backing implementations inos.ProcessLike
. The flag,timeoutGracePeriod
, allows for a configurable use ofSIGKILL
, which forcibly kills a process, after the issue of aSIGTERM
, which allows a process to clean up. The values for the flag have the following behaviours:timeout != -1
, only aSIGTERM
will be issued, requiring the child process to gracefully terminate.timeout != -1
, only aSIGKILL
is issued, demanding the child terminate immediately with no chance of graceful cleanup.timeout != -1
, first issue aSIGTERM
and then wait for a furthern
milliseconds before issuing aSIGKILL
, this provides a reasonable timeframe for process cleanup, but accounts for misbehaving processes.For now, the default has been set to
timeoutGracePeriod = 1000
.