def kill_children():
    """Terminate all child processes."""
    try:
        import psutil
    except ImportError:
        logger.warn(
            "missing psutil; --jobs may not properly terminate",
            extra="run 'pip install coconut[jobs]' to fix",
        )
    else:
        master = psutil.Process()
        children = master.children(recursive=True)
        while children:
            for child in children:
                try:
                    child.terminate()
                except psutil.NoSuchProcess:
                    pass  # process is already dead, so do nothing
            children = master.children(recursive=True)
def kill_children ( ) : try : import psutil except ImportError : logger . warn ( "missing psutil; --jobs may not properly terminate" , extra = "run 'pip install coconut[jobs]' to fix" , ) else : master = psutil . Process ( ) children = master . children ( recursive = True ) while children : for child in children : try : child . terminate ( ) except psutil . NoSuchProcess : pass children = master . children ( recursive = True )
Terminate all child processes.