You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.
Here's how you set up a signal handler for the current process, that makes sure any child processes that terminate then properly die (rather than sitting around in "defunct" status leaking resources):
defwait_for_children(signal, stack_frame):
p=psutil.Process(os.getpid())
children=p.get_children()
forchildinchildren:
try:
logging.debug('Waiting for child %s'% (child,))
os.wait4(child.pid, os.WNOHANG)
exceptOSError:
logging.debug('Exception while waiting for child with pid %s'% (child.pid,))
signal.signal(signal.SIGCHLD, wait_for_children)
pretty arcane stuff! there must be a nicer solution...
You can also use signal to special-case ctrl+c, or any other OS signals. This may be too low-level for most users tho, so maybe not such a high priority.
The text was updated successfully, but these errors were encountered:
Here's how you set up a signal handler for the current process, that makes sure any child processes that terminate then properly die (rather than sitting around in "defunct" status leaking resources):
pretty arcane stuff! there must be a nicer solution...
You can also use
signal
to special-case ctrl+c, or any other OS signals. This may be too low-level for most users tho, so maybe not such a high priority.The text was updated successfully, but these errors were encountered: