Skip to content

process_utils

diapason.security.process_utils

Subprocess helpers with hard timeout and process-tree cleanup.

run_with_timeout(args, *, timeout, shell=False, cwd=None, env=None)

Run a command and kill its process group if the deadline expires.

subprocess.run(timeout=...) kills only the immediate child. Starting a new session on POSIX lets Diapason terminate the whole process group, so a timed-out shell command cannot leave grandchildren running in background.