Skip to content

Commit 83046a0

Browse files
committed
Don't kill processes in RunAndProcessLines
As we just did for tasks, close their stdout pipe instead. This makes the called process terminate more gracefully. This isn't a change that we *need* to make, it's just a bit nicer.
1 parent 8d7740a commit 83046a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/commands/oscommands/cmd_obj_runner.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,17 @@ func (self *cmdObjRunner) RunAndProcessLines(cmdObj *CmdObj, onLine func(line st
171171
line := scanner.Text()
172172
stop, err := onLine(line)
173173
if err != nil {
174+
stdoutPipe.Close()
174175
return err
175176
}
176177
if stop {
177-
_ = Kill(cmd)
178+
stdoutPipe.Close() // close the pipe so that the called process terminates
178179
break
179180
}
180181
}
181182

182183
if scanner.Err() != nil {
183-
_ = Kill(cmd)
184+
stdoutPipe.Close()
184185
return scanner.Err()
185186
}
186187

0 commit comments

Comments
 (0)