Skip to content

Commit

Permalink
feat(exec) ignore ctrl-c when exec
Browse files Browse the repository at this point in the history
  • Loading branch information
sadayuki-matsuno committed Jul 2, 2021
1 parent 5d0345a commit 5a77349
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package cmd
import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"

"github.com/fatih/color"
"github.com/knqyf263/pet/config"
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5a77349

Please sign in to comment.