Skip to content

Commit ddaed6e

Browse files
fix(turbo): graceful shutdown on sighup (#10764)
### Description When trying to figure out why grouped logs don't get flushed on GitHub Actions timeouts I came across actions/runner#1309 Seems promising, since I have verified that `SIGINT` results in logs getting flushed, but `SIGHUP` wouldn't trigger a flush. ### Testing Instructions Send a `SIGHUP` to `turbo` and verify that everything gets shut down cleanly: ``` [130 olszewski@macbookpro] /tmp/grouped $ turbo_dev --skip-infer dev --log-order=grouped turbo 2.5.6-canary.1 • Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web • Running dev in 5 packages • Remote caching disabled web:dev: cache bypass, force executing b1407803afdc4dc7 web:dev: web:dev: > [email protected] dev /private/tmp/grouped/apps/web web:dev: > next dev --turbopack --port 3000 web:dev: web:dev: ▲ Next.js 15.4.2 (Turbopack) web:dev: - Local: http://localhost:3000 web:dev: - Network: http://192.168.86.73:3000 web:dev: web:dev: ✓ Starting... web:dev: ✓ Ready in 942ms web:dev: docs:dev: cache bypass, force executing 9119eefc14447289 docs:dev: docs:dev: > [email protected] dev /private/tmp/grouped/apps/docs docs:dev: > next dev --turbopack --port 3001 docs:dev: docs:dev: ▲ Next.js 15.4.2 (Turbopack) docs:dev: - Local: http://localhost:3001 docs:dev: - Network: http://192.168.86.73:3001 docs:dev: docs:dev: ✓ Starting... docs:dev: ✓ Ready in 943ms docs:dev: ERROR run failed: command exited (1) ```
1 parent 6f5557f commit ddaed6e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/turborepo-signals/src/listeners.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ pub fn get_signal() -> Result<impl Stream<Item = Option<Signal>>, Error> {
2323
use tokio::signal::unix;
2424
let mut sigint = unix::signal(unix::SignalKind::interrupt())?;
2525
let mut sigterm = unix::signal(unix::SignalKind::terminate())?;
26+
let mut sighup = unix::signal(unix::SignalKind::hangup())?;
2627

2728
Ok(stream::once(async move {
2829
tokio::select! {
2930
res = sigint.recv() => {
3031
res.map(|_| Signal::Interrupt)
3132
}
33+
res = sighup.recv() => {
34+
res.map(|_| Signal::Interrupt)
35+
}
3236
res = sigterm.recv() => {
3337
res.map(|_| Signal::Terminate)
3438
}

0 commit comments

Comments
 (0)