From 3f6b1a9d811d16278b0cd9b736d500fddfa5e008 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 May 2024 17:24:36 +0530 Subject: [PATCH] launch --hold: Fix hold not working if kernel signals process group with SIGINT Fixes #7466 --- docs/changelog.rst | 2 ++ tools/tui/run.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ca329adc000..ce87f870528 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -94,6 +94,8 @@ Detailed list of changes - Fix kitten @ set-background-opacity limited to min opacity of 0.1 instead of 0 (:iss:`7463`) +- launch --hold: Fix hold not working if kernel signals process group with SIGINT (:iss:`7466`) + 0.34.1 [2024-04-19] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tools/tui/run.go b/tools/tui/run.go index 50b713ea0ca..cc3a8a69e15 100644 --- a/tools/tui/run.go +++ b/tools/tui/run.go @@ -7,6 +7,7 @@ import ( "kitty" "os" "os/exec" + "os/signal" "path/filepath" "runtime" "strings" @@ -216,7 +217,15 @@ func RunCommandRestoringTerminalToSaneStateAfter(cmd []string) { defer term.Close() } } - err = c.Run() + func() { + if err = c.Start(); err != nil { + fmt.Fprintln(os.Stderr, cmd[0], "failed with error:", err) + return + } + signal.Ignore(os.Interrupt) + defer signal.Reset(os.Interrupt) + err = c.Wait() + }() if err != nil { fmt.Fprintln(os.Stderr, cmd[0], "failed with error:", err) }