Closing the rotators when the process finishes

This commit is contained in:
Diptanu Choudhury 2016-02-23 13:32:17 -08:00
parent 9eb646f5a2
commit 7fcbdf5a9b
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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 {