Removing all the destroy logic from wait and calling exit after wait on all drivers

This commit is contained in:
Diptanu Choudhury
2016-03-18 12:04:11 -07:00
parent 3bb4849a2d
commit d61ae3ad04
6 changed files with 17 additions and 5 deletions

View File

@@ -241,11 +241,6 @@ func (e *UniversalExecutor) UpdateTask(task *structs.Task) error {
func (e *UniversalExecutor) wait() {
defer close(e.processExited)
err := e.cmd.Wait()
if e.syslogServer != nil {
e.syslogServer.Shutdown()
}
e.lre.Close()
e.lro.Close()
if err == nil {
e.exitState = &ProcessState{Pid: 0, ExitCode: 0, Time: time.Now()}
return
@@ -269,6 +264,12 @@ var (
// process
func (e *UniversalExecutor) Exit() error {
var merr multierror.Error
if e.syslogServer != nil {
e.syslogServer.Shutdown()
}
e.lre.Close()
e.lro.Close()
if e.command != nil && e.cmd.Process != nil {
proc, err := os.FindProcess(e.cmd.Process.Pid)
if err != nil {