Skip to content

Escalating signal handling: kill child processes on repeated Ctrl-C #40

@CodeEnPlace

Description

@CodeEnPlace

Currently, Ctrl-C sets the done flag and waits for in-flight tests to finish naturally. This is safe (no orphans) but slow if a test is stuck.

Proposed escalation

  1. 1st Ctrl-C: Set done, stop picking new work, let in-flight phases finish (current behavior)
  2. 2nd Ctrl-C: Send SIGKILL to all child process groups, unblocking worker threads immediately
  3. 3rd Ctrl-C: std::process::exit(1) as a last resort

This requires tracking spawned child PIDs in a global registry that the signal handler can access. The kill_process_tree function in phase.rs already uses SIGKILL on process groups, so the mechanism exists — it just needs to be callable from the handler.

Context

Children are spawned with process_group(0) so they're in their own process groups. SIGKILL to -pgid kills the entire group. This is already tested to work 3+ levels deep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions