ddp_utils.process¶
import ddp_utils.process
Provide best-effort cross-platform process termination by identifier.
Examples
Use this public operation:
from ddp_utils.process import force_kill_pid
rejected = force_kill_pid(0)
- ddp_utils.process.force_kill_pid(pid: int) bool¶
Request forceful termination of one process by its identifier.
Windows invokes
taskkill /F /Tto include the process tree. Other platforms invokekill -9. Each command has a five-second timeout. Invalid identifiers, nonzero command results, and execution errors produce a softFalseresult; execution errors are also written at debug level.Parameters
Name
Type
Description
pid
int
Positive integer process identifier. Booleans, non-integers, and non-positive values are rejected without launching a command.
Returns
Type
Description
bool
Truewhen the platform command exits successfully; otherwiseFalse. Success reports the command result and does not perform an additional liveness check.Examples
Reject an invalid process identifier without invoking the operating system:
from ddp_utils.process import force_kill_pid assert force_kill_pid(0) is False