Skip to content

fix: avoid kill timeout exit delays#601

Merged
gustavohenke merged 1 commit into
open-cli-tools:mainfrom
rajanpanth:fix/kill-timeout-exit-delay
Jul 21, 2026
Merged

fix: avoid kill timeout exit delays#601
gustavohenke merged 1 commit into
open-cli-tools:mainfrom
rajanpanth:fix/kill-timeout-exit-delay

Conversation

@rajanpanth

Copy link
Copy Markdown
Contributor

Summary

  • release the kill-timeout timer's event-loop reference
  • add regression coverage for cooperative processes that stop before force-kill is needed

Problem

When killTimeout is enabled, KillOthers schedules a referenced timer before sending the initial termination signal. If all targeted processes stop cooperatively, that timer is the only remaining active handle and keeps concurrently running until the full timeout expires.

Fix

Unreference the force-kill timer. A child process that is still running continues to keep Node alive, so the timer can still deliver SIGKILL; once every child has stopped, the timer no longer delays exit.

Testing

  • pnpm exec vitest run --project unit lib/flow-control/kill-others.spec.ts
  • pnpm test
  • pnpm exec vitest --coverage
  • pnpm typecheck
  • pnpm lint
  • pnpm exec prettier --check "**/*.{json,y?(a)ml,md}"
  • pnpm build
  • pnpm test:smoke

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.858%. remained the same — rajanpanth:fix/kill-timeout-exit-delay into open-cli-tools:main

@gustavohenke
gustavohenke self-requested a review July 21, 2026 05:27

@gustavohenke gustavohenke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@gustavohenke
gustavohenke merged commit 1080199 into open-cli-tools:main Jul 21, 2026
21 checks passed
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.

3 participants