mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-22 05:29:44 +02:00
show stdout in error message if stderr is blank
This commit is contained in:
parent
20ec6d98ad
commit
7128d822cb
@ -226,6 +226,9 @@ func (self *cmdObjRunner) runAndStreamAux(
|
||||
return err
|
||||
}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
handler.stdoutPipe = io.TeeReader(handler.stdoutPipe, &stdout)
|
||||
|
||||
defer func() {
|
||||
if closeErr := handler.close(); closeErr != nil {
|
||||
self.log.Error(closeErr)
|
||||
@ -237,10 +240,14 @@ func (self *cmdObjRunner) runAndStreamAux(
|
||||
err = cmd.Wait()
|
||||
if err != nil {
|
||||
errStr := stderr.String()
|
||||
if cmdObj.ShouldIgnoreEmptyError() && errStr == "" {
|
||||
if errStr != "" {
|
||||
return errors.New(errStr)
|
||||
}
|
||||
|
||||
if cmdObj.ShouldIgnoreEmptyError() {
|
||||
return nil
|
||||
}
|
||||
return errors.New(stderr.String())
|
||||
return errors.New(stdout.String())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user