fix: Keep npm-wrapper group SIGTERM and SIGHUP from force-killing tasks (#14972)
### Description
Ran `cargo test` locally on macOS for the turborepo get_signal change;
it fails the same way on the base branch, so the failure predates this
change (it fails the same way on upstream/main). Turbo reports the tasks
as force killed within about a tenth of a second, and the task's cleanup
never runs. Closing a bash terminal that is running turbo the same way
does this too, because bash delivers SIGHUP to the foreground process
group.
The wrapper and the native binary share a process group, so one group
signal reaches the binary from the kernel and again when the wrapper
forwards SIGTERM or SIGHUP. Shutdown counts each arrival as its own stop
request and treats the second as a forced exit. A group SIGINT stays a
single stop because the Unix wrapper forwards only SIGTERM and SIGHUP.
The wrapper sets __TURBO_NPM_WRAPPER when it spawns the native binary.
On Unix, with that marker set, the signal listener keeps the first
SIGTERM and the first SIGHUP and drops a later copy of the same signal,
while every SIGINT is still delivered. Without the marker, every signal
is still kept, so a native binary and a genuine second stop request keep
escalating.
Shutdown tests cover one group SIGTERM or SIGHUP for each entry point,
and a repeated group signal through the wrapper, and expect cleanup to
finish with no force kill.
Fixes #14966
### Testing Instructions
Ran `cargo test` locally on macOS for the turborepo get_signal change;
it fails the same way on the base branch, so the failure predates this
change (it fails the same way on upstream/main).
A run with the turborepo get_signal change reverted gave no clear
result, so no test is shown to catch this bug.
The changed test crates/turborepo/tests/graceful_shutdown_test.rs did
not run here: no test runner for it was available.
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>