Skip to content

Commit

Permalink
exit on first interupption signal
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Jul 6, 2017
1 parent b897a94 commit 1b68b24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .goxc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default",
"publish-github"
],
"PackageVersion": "0.0.2",
"PackageVersion": "0.0.3",
"TaskSettings": {
"publish-github": {
"owner": "reddec",
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ main() {
mon := monexec.Monitor{Executables: []*monexec.Executable{exe}}
ctx, stp := context.WithCancel(context.Background())

c := make(chan os.Signal, 3)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
c := make(chan os.Signal, 2)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
go func() {
for range c {
stp()
break
}
}()

Expand Down

0 comments on commit 1b68b24

Please sign in to comment.