From 3da5e5020a3bbf3b7d668c0f021b831bfe478898 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Tue, 23 Feb 2016 13:32:17 -0800 Subject: [PATCH] Closing the rotators when the process finishes --- client/driver/executor/executor.go | 2 ++ client/driver/executor/executor_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/driver/executor/executor.go b/client/driver/executor/executor.go index 104edd757..47c33bf4b 100644 --- a/client/driver/executor/executor.go +++ b/client/driver/executor/executor.go @@ -194,6 +194,8 @@ func (e *UniversalExecutor) UpdateLogConfig(logConfig *structs.LogConfig) error func (e *UniversalExecutor) wait() { defer close(e.processExited) err := e.cmd.Wait() + e.lre.Close() + e.lro.Close() if err == nil { e.exitState = &ProcessState{Pid: 0, ExitCode: 0, Time: time.Now()} return diff --git a/client/driver/executor/executor_test.go b/client/driver/executor/executor_test.go index 609e7e64a..68195953d 100644 --- a/client/driver/executor/executor_test.go +++ b/client/driver/executor/executor_test.go @@ -85,7 +85,7 @@ func TestExecutor_Start_Wait_Failure_Code(t *testing.T) { func TestExecutor_Start_Wait(t *testing.T) { execCmd := ExecCommand{Cmd: "/bin/echo", Args: []string{"hello world"}} ctx := testExecutorContext(t) - //defer ctx.AllocDir.Destroy() + defer ctx.AllocDir.Destroy() executor := NewExecutor(log.New(os.Stdout, "", log.LstdFlags)) ps, err := executor.LaunchCmd(&execCmd, ctx) if err != nil {