Skip to main content

Module process

Module process 

Source
Expand description

Standalone process lifecycle functions for the SSH agent daemon.

Each function handles a single concern (PID files, signal checks, process spawning, termination) and is independently testable without a running Unix socket.

Functionsยง

cleanup_stale_files
Remove stale daemon files (PID file, socket, environment file).
is_process_running
Check whether a process with the given PID is running.
read_pid_file
Read a process ID from a PID file, returning None if the file does not exist.
socket_is_connectable
Test whether a Unix domain socket at path accepts connections.
spawn_detached
Spawn a detached daemon process by re-executing the current binary.
terminate_process
Send SIGTERM to a process and wait for it to exit, escalating to SIGKILL if it does not terminate within timeout.
write_pid_file
Write a process ID to a PID file with restricted permissions.