Skip to content

vp run: on Ctrl+C, the first task to exit with 130 makes vp SIGKILL the others mid-cleanup, orphaning their children #3581

Todo

Description

@wladpaiva

What happens

With vp run --parallel (and -r), pressing Ctrl+C sends SIGINT to every task. Most tools exit with 130 on SIGINT. vp run treats that 130 as a failure and cancels the run, and cancellation SIGKILLs the tasks that are still shutting down. A task that needs a moment to clean up never gets it.

This bites hardest with tools that put their own child in a separate process group and stop it from their signal handler, like portless (detached: true so it can kill the whole group on Ctrl+C). When portless is SIGKILLed mid-shutdown, the dev server it started is orphaned and keeps running on the terminal. In our monorepo, tsx watch/vpx --watch for the API survives and keeps reading stdin, so pressing Enter later reruns the server and prints into the shell. The same happens when any task fails for a real reason while the others are running (see voidzero-dev/vite-task#822).

Minimal repro

Two packages, run with vp run --parallel -r dev, then Ctrl+C:

a/run.sh (exits 130 on SIGINT, like most CLIs):

#!/bin/sh
trap 'echo "a got INT, exit 130" >> log; exit 130' INT
while :; do sleep 0.2; done

b/run.sh (needs 2 s to clean up):

#!/bin/sh
for s in INT TERM HUP; do trap "echo 'b got $s, cleaning up 2s' >> log; sleep 2; echo 'b clean exit' >> log; exit 0" $s; done
while :; do sleep 0.2; done

Log after Ctrl+C:

b got INT, cleaning up 2s
a got INT, exit 130

b clean exit never appears: b is killed during its cleanup. Same if a exits 1 on its own without Ctrl+C: b receives no catchable signal at all (its INT/TERM/HUP traps never run), so it was SIGKILLed.

Repro run on Vite+ 1.6.0 and 1.8.0 on Linux; the orphaned dev server is what we hit day to day on macOS.

Expected

  • When the run was interrupted by the user (SIGINT/SIGTERM/SIGHUP to vp), a task exiting 130/143/129 is the normal answer to that signal, not a failure that cancels siblings. Let every task finish its own shutdown.
  • When cancelling siblings after a real failure, send SIGTERM (to the task's process group) first and SIGKILL only after a grace period, so tools can stop what they started.

Related

Activity

  1. added theissue type on Nov 25, 2026
  2. ViktorRingnes commented on Nov 26, 2026

    @ViktorRingnes

    I'd like to work on this if no one else is 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions