1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-23 16:22:24 +03:00

Suppress output from background fetch

However, show it when there was an error. This is important for the case that a
fork that you have as a remote was deleted, in which case the command log is the
only way to get notified about that.
This commit is contained in:
Stefan Haller
2025-11-15 17:47:35 +01:00
parent eb91a43d58
commit f8a48b61fc
4 changed files with 32 additions and 1 deletions

View File

@@ -227,7 +227,13 @@ func (self *cmdObjRunner) runAndStreamAux(
cmdObj *CmdObj,
onRun func(*cmdHandler, io.Writer),
) error {
cmdWriter := self.guiIO.newCmdWriterFn()
var cmdWriter io.Writer
var combinedOutput bytes.Buffer
if cmdObj.ShouldSuppressOutputUnlessError() {
cmdWriter = &combinedOutput
} else {
cmdWriter = self.guiIO.newCmdWriterFn()
}
if cmdObj.ShouldLog() {
self.logCmdObj(cmdObj)
@@ -267,6 +273,10 @@ func (self *cmdObjRunner) runAndStreamAux(
self.log.Infof("%s (%s)", cmdObj.ToString(), time.Since(t))
if err != nil {
if cmdObj.suppressOutputUnlessError {
_, _ = self.guiIO.newCmdWriterFn().Write(combinedOutput.Bytes())
}
errStr := stderr.String()
if errStr != "" {
return errors.New(errStr)