Skip to content

EXC-1943 Reap spec nvims when an interrupted test run exits - #44

Merged
macintacos merged 1 commit into
mainfrom
EXC-1943/reap-interrupted-spec-nvims
Oct 13, 2026
Merged

macintacos merged 1 commit into
mainfrom
EXC-1943/reap-interrupted-spec-nvims

Conversation

@macintacos

Copy link
Copy Markdown
Owner

Part of: EXC-1943

Change Kind: bug fix

What changed

An interrupted mise run test (a timeout, Ctrl-C, a closed pane, a cancelled pre-push) used to leave its headless spec nvims running forever: one signalled inside vim.fn.system() hangs in exit teardown, ignores SIGTERM, and is reparented to PID 1. The test runner now SIGKILLs every harness nvim left in its own process group whenever it exits, and turns HUP, INT and TERM into a normal exit so that reap runs. .mise/tasks/coverage has the same leak shape and is left for a follow-up.

What to test

  • Start bash .mise/tasks/test, send its process group TERM, HUP or INT a few seconds in, and confirm pgrep -g <pgid> finds nothing afterwards. Before this change, the same test left 25 spec nvims behind.
  • A clean run (mise run test tests/git_spec.lua) still exits 0, and a failing spec still exits 1.
  • The reap is scoped by process group plus a PlenaryBustedDirectory|plenary.busted pattern, so a concurrent suite in another worktree, or an editor nvim in the same group, is left alone.

A spec nvim signalled inside vim.fn.system() hangs in exit teardown,
ignores SIGTERM, and outlives an interrupted run reparented to PID 1.

- On exit, SIGKILL every harness nvim left in the runner's process
  group
- Trap HUP, INT and TERM into a normal exit so that reap runs
- Background the outer nvim and wait on it, since bash defers a trap
  until its foreground child exits
@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

EXC-1943

@macintacos
macintacos merged commit 09764d7 into main Oct 13, 2026
2 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.

1 participant