mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
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.
This commit is contained in:
@ -171,16 +171,17 @@ func (self *cmdObjRunner) RunAndProcessLines(cmdObj *CmdObj, onLine func(line st
|
|||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
stop, err := onLine(line)
|
stop, err := onLine(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
stdoutPipe.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if stop {
|
if stop {
|
||||||
_ = Kill(cmd)
|
stdoutPipe.Close() // close the pipe so that the called process terminates
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scanner.Err() != nil {
|
if scanner.Err() != nil {
|
||||||
_ = Kill(cmd)
|
stdoutPipe.Close()
|
||||||
return scanner.Err()
|
return scanner.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user