Replies: 1 comment 16 replies
-
The wait will stop early if the process exits early. The stop actions work as follows: The action specifies what to do, the timeout specifies how long to wait before going to the next action (or return if it's the last action). So your example will first wait max 10 seconds for the process to exit on its own, if it hasn't exited after 10 seconds, reproc will send SIGTERM and wait max 5 more seconds for the process to exit. If it hasn't exited after 5 seconds, reproc will send SIGKILL and wait max 5 more seconds for the process to exit. If it exits within 5 seconds, reproc returns the exit status, otherwise, reproc will return an error. |
Beta Was this translation helpful? Give feedback.
16 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I'm still a little confused about stopping a long running process.
Suppose I have an internal mechanism to stop it, or it will simply finish its work 'soon'.
proc.stop(... wait : 10s, terminate :5s, kill 5s)
Question 1: If I call this function, and after 2 seconds the process naturally exits, my understanding here is that I will still wait for 10 seconds. So how to 'exit early' if the process has cleanly closed, otherwise wait for 10s? i.e. I don't want to wait if I don't have to.
Question 2: if the 10 seconds expire, then the process is sent a SIGTERM after 5 more seconds, and then a SIGKILL after 5 more seconds?
Beta Was this translation helpful? Give feedback.
All reactions