ddp_utils.browser.backends.native.process¶
import ddp_utils.browser.backends.native.process
Process-state and process-tree termination for native browser sessions.
- class ddp_utils.browser.backends.native.process.NativeProcessController¶
Bases:
objectControl one owned browser process tree using lazy
psutilaccess.Examples
Check whether a native session process remains alive:
running = NativeProcessController().is_running(session.native.pid)
- is_running(pid: int) bool¶
Return whether a process exists and is not a zombie.
Parameters
Name
Type
Description
pid
int
Operating-system process identifier.
Returns
Type
Description
bool
Truefor a live non-zombie process; otherwiseFalse.Examples
Poll an owned browser process:
if controller.is_running(info.pid): print("browser is running")
- terminate(pid: int, *, timeout: float, force: bool) bool¶
Terminate an owned process tree and optionally force survivors.
Parameters
Name
Type
Description
pid
int
Root process identifier.
timeout
float
Grace period in seconds after terminate signals.
force
bool
Kill surviving processes after the grace period.
Returns
Type
Description
bool
Truewhen the complete observed process tree is no longer alive.Examples
Close a browser and force only after its grace period:
closed = controller.terminate(info.pid, timeout=5, force=True)