Skip to content

Support killing process trees cross-platform - #1

Open
jamilahmadzai wants to merge 2 commits into
mainfrom
codex/process-tree-21
Open

Support killing process trees cross-platform#1
jamilahmadzai wants to merge 2 commits into
mainfrom
codex/process-tree-21

Conversation

@jamilahmadzai

@jamilahmadzai jamilahmadzai commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • honor the existing tree option on macOS and Linux with pidtree, while preserving Windows taskkill behavior
  • signal descendants leaf-first, tolerate children that exit during traversal, and protect the current process ancestry
  • keep descendants and concrete name-matched root PIDs tracked through forceAfterTimeout and waitForExit, including children reparented after their root exits
  • match Linux process titles through the command name as well as the executable basename, consistent with process-exists
  • cover PID, process-name, opt-out, grandchildren, and reparented-child behavior; update the README and TypeScript definition

Resolves sindresorhus#21

This also addresses the maintainer feedback on the earlier attempt in #34: it uses pidtree instead of tree-kill, updates index.d.ts, and makes the default/tree-disabled regression tests cross-platform so the established Windows behavior is covered whenever the Windows job is enabled.

Validation

  • npm test on Node.js 24: 29/29 tests, XO, and tsd pass
  • npx --yes node@20 --test: 29/29 tests pass
  • GitHub Actions passes the complete Node.js 20/24 × Ubuntu/macOS matrix: https://github.com/jamilahmadzai/fkill/actions/runs/30042371523
  • five consecutive focused process-tree regression runs
  • npm pack --dry-run
  • git diff --check

This fork-local PR is the review artifact because upstream currently has pull requests disabled. It is ready to transplant or merge if upstream contributions are reopened.

@jamilahmadzai
jamilahmadzai force-pushed the codex/process-tree-21 branch from 4e22c07 to 29ee3e5 Compare July 23, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kill tree (all sub-processes)

1 participant