1
0
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:
Stefan Haller
2025-07-29 10:04:30 +02:00
parent 8d7740a5ac
commit 83046a05d4

View File

@ -171,16 +171,17 @@ func (self *cmdObjRunner) RunAndProcessLines(cmdObj *CmdObj, onLine func(line st
line := scanner.Text()
stop, err := onLine(line)
if err != nil {
stdoutPipe.Close()
return err
}
if stop {
_ = Kill(cmd)
stdoutPipe.Close() // close the pipe so that the called process terminates
break
}
}
if scanner.Err() != nil {
_ = Kill(cmd)
stdoutPipe.Close()
return scanner.Err()
}