Skip to content

Avoid checking process existence before successful kills#1

Open
Davifek wants to merge 1 commit into
mainfrom
fix-lazy-existence-check
Open

Avoid checking process existence before successful kills#1
Davifek wants to merge 1 commit into
mainfrom
fix-lazy-existence-check

Conversation

@Davifek
Copy link
Copy Markdown
Owner

@Davifek Davifek commented May 20, 2026

Summary

  • Defer processExistsMultiple() until after a kill attempt fails.
  • Avoid the full process-existence lookup on successful kills, which keeps the fast path close to the platform kill command.
  • Add regression coverage for the success and failure call order.

Verification

  • node --test lazy-existence-check.test.js
  • xo index.js test.js lazy-existence-check.test.js
  • tsd
  • Manual Windows check: spawned a Node child process, killed it with fkill(..., {force: true, waitForExit: 2000}), and confirmed it no longer existed.

Note: I used AI assistance to prepare this patch, then reviewed and tested it locally.

Upstream target: sindresorhus#25
IssueHunt: https://oss.issuehunt.io/r/sindresorhus/fkill/issues/25

Upstream PR creation is currently blocked for this account/session with CreatePullRequest permission errors, so this PR documents the patch in the fork while the upstream compare URL remains ready:
https://github.com/sindresorhus/fkill/compare/main...Davifek:fkill:fix-lazy-existence-check?quick_pull=1

@Davifek Davifek changed the title Diagnostic: fkill lazy existence check Avoid checking process existence before successful kills May 20, 2026
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.

1 participant