From 5a77349e349acf5541c5f7a7493855fcbc961db0 Mon Sep 17 00:00:00 2001 From: Sadayuki Matsuno Date: Sat, 3 Jul 2021 08:12:55 +0900 Subject: [PATCH] feat(exec) ignore ctrl-c when exec --- cmd/exec.go | 4 ++++ go.mod | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cmd/exec.go b/cmd/exec.go index b602d7c..4189a6d 100644 --- a/cmd/exec.go +++ b/cmd/exec.go @@ -3,7 +3,9 @@ package cmd import ( "fmt" "os" + "os/signal" "strings" + "syscall" "github.com/fatih/color" "github.com/knqyf263/pet/config" @@ -37,6 +39,8 @@ func execute(cmd *cobra.Command, args []string) (err error) { if config.Flag.Command { fmt.Printf("%s: %s\n", color.YellowString("Command"), command) } + + signal.Ignore(syscall.SIGINT) return run(command, os.Stdin, os.Stdout) } diff --git a/go.mod b/go.mod index 1295d75..ef8a658 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/knqyf263/pet +go 1.16 + require ( github.com/BurntSushi/toml v0.3.0 github.com/briandowns/spinner v0.0.0-20170614154858-48dbb65d7bd5