Skip to content

Commit

Permalink
fix signaling
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Jul 6, 2017
1 parent 241b746 commit b897a94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .goxc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"default",
"publish-github"
],
"PackageVersion": "0.0.1",
"PackageVersion": "0.0.2",
"TaskSettings": {
"publish-github": {
"owner": "reddec",
"repository": "monexec"
}
},
"ConfigVersion": "0.9"
}
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ main() {
ctx, stp := context.WithCancel(context.Background())

c := make(chan os.Signal, 3)
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGHUP)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
for range c {
stp()
Expand Down
6 changes: 3 additions & 3 deletions monexec/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func (b *Executable) Env(arg, value string) *Executable {
// SIGTERM is used
func (exe *Executable) stopOrKill(logger *log.Logger, cmd *exec.Cmd) {
ch := make(chan struct{}, 1)
logger.Println("Sending SIGKILL")
cmd.Process.Kill()
logger.Println("Sending SIGKTERM")
cmd.Process.Signal(syscall.SIGTERM)
go func() {
cmd.Wait()
ch <- struct{}{}
Expand All @@ -95,7 +95,7 @@ func (exe *Executable) stopOrKill(logger *log.Logger, cmd *exec.Cmd) {
logger.Println("Process gracefull stopped")
case <-time.After(exe.StopTimeout):
logger.Println("Process gracefull shutdown waiting timeout")
cmd.Process.Signal(syscall.SIGTERM)
cmd.Process.Signal(syscall.SIGKILL)
}
}

Expand Down

0 comments on commit b897a94

Please sign in to comment.