From d53591052e03f055ea120062f4ec721d66b15daf Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Tue, 8 Dec 2015 08:14:13 -0800 Subject: [PATCH] Sending the user process sigint during shutdown on linux --- client/driver/executor/exec_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/driver/executor/exec_linux.go b/client/driver/executor/exec_linux.go index 26d2d7145ffc..256cc39f49b7 100644 --- a/client/driver/executor/exec_linux.go +++ b/client/driver/executor/exec_linux.go @@ -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