Skip to content

Commit

Permalink
Merge pull request #543 from hashicorp/b-exec-linux-stop
Browse files Browse the repository at this point in the history
Sending the user process sigint during shutdown on linux
  • Loading branch information
diptanu committed Dec 8, 2015
2 parents 8863d0b + d535910 commit 6aa89c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/driver/executor/exec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,15 @@ func (e *LinuxExecutor) Wait() *cstructs.WaitResult {
return res
}

// Shutdown sends the user process an interrupt signal indicating that it is
// about to be forcefully shutdown in sometime
func (e *LinuxExecutor) Shutdown() error {
return e.ForceStop()
proc, err := os.FindProcess(e.spawn.UserPid)
if err != nil {
return fmt.Errorf("Failed to find user processes %v: %v", e.spawn.UserPid, err)
}

return proc.Signal(os.Interrupt)
}

// ForceStop immediately exits the user process and cleans up both the task
Expand Down

0 comments on commit 6aa89c4

Please sign in to comment.