Ignore SIGINT when running as proxy

This commit is contained in:
Junegunn Choi 2024-05-22 20:01:37 +09:00
parent 7205203dc8
commit 552158f3ad
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -7,6 +7,7 @@ import (
"io" "io"
"os" "os"
"os/exec" "os/exec"
"os/signal"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@ -102,6 +103,7 @@ func runProxy(commandPrefix string, cmdBuilder func(temp string) *exec.Cmd, opts
defer os.Remove(temp) defer os.Remove(temp)
cmd := cmdBuilder(temp) cmd := cmdBuilder(temp)
signal.Ignore(os.Interrupt)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
if exitError, ok := err.(*exec.ExitError); ok { if exitError, ok := err.(*exec.ExitError); ok {
code := exitError.ExitCode() code := exitError.ExitCode()