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 /T to include the process tree. Other platforms invoke kill -9. Each command has a five-second timeout. Invalid identifiers, nonzero command results, and execution errors produce a soft False result; 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

True when the platform command exits successfully; otherwise False. 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