Skip to content

Terminate all subprocesses#225

Merged
tamland merged 1 commit into
gorakhargosh:masterfrom
berdario:terminate_subprocesses
Mar 23, 2014
Merged

Terminate all subprocesses#225
tamland merged 1 commit into
gorakhargosh:masterfrom
berdario:terminate_subprocesses

Conversation

@berdario

Copy link
Copy Markdown
Contributor

auto-restart won't terminate all children processes

 1e39bb6da6cffe8b  dario@macbook /tmp> cat file.py
from subprocess import call
call('python3 -m http.server'.split())
1e39bb6da6cffe8b  dario@macbook /tmp> 
watchmedo auto-restart -p /tmp/file.py python file.py
Serving HTTP on 0.0.0.0 port 8000 ...
on_any_event(self=<watchdog.tricks.AutoRestartTrick object at 0x2c7f450>, event=<FileModifiedEvent: src_path=/tmp/file.py>)
Traceback (most recent call last):
[SNIP]
OSError: [Errno 98] Address already in use

(I stumbled upon this problem with a Warp server run through the runhaskell program, that spawns a runghc and a ghc process, the dummy file.py is only for your ease to reproduce it)

I'm not storing the result of os.getpgid(self.process.pid) because it could change during the execution

thus handling all its children in the same group
(setsid is needed to get the process into a different group than watchdog)
tamland added a commit that referenced this pull request Mar 23, 2014
@tamland
tamland merged commit 3a0f0ec into gorakhargosh:master Mar 23, 2014
CCP-Aporia pushed a commit to CCP-Aporia/watchdog that referenced this pull request Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants