tlc.utils.subprocess_with_parent_termination
¶
Subprocess management with automatic parent termination.
Module Contents¶
Classes¶
Class |
Description |
---|---|
Create a subprocess that will terminate when the parent process dies. |
API¶
- class SubprocessWithParentTerminationBase( )¶
Create a subprocess that will terminate when the parent process dies.
This is useful for creating subprocesses that should be terminated when the parent process dies even if the parent dies unexpectedly or forcefully.
As a convenience the class also provides a context manager interface that will terminate the subprocess when the context is exited:
```python with SubprocessWithParentTermination(["ls", "-l"]) as process: process.wait() ```