Skip to content

Commit

Permalink
Fix flakey pull_merge_conflict test
Browse files Browse the repository at this point in the history
It's not clear what was happening but it seemed like we sometimes weren't
fully writing to our stdout buffer (which is used for the error message)
even though we had returned from cmd.Wait().

Not sure what the cause was but removing an unnecessary goroutine fixed it.
  • Loading branch information
jesseduffield committed Jul 10, 2023
1 parent ee18bfc commit 1190f1b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/commands/oscommands/cmd_obj_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ func (self *cmdObjRunner) runAndStreamAux(
if cmdObj.ShouldIgnoreEmptyError() {
return nil
}
return errors.New(stdout.String())
stdoutStr := stdout.String()
if stdoutStr != "" {
return errors.New(stdoutStr)
}
return errors.New("Command exited with non-zero exit code, but no output")
}

return nil
Expand Down Expand Up @@ -308,9 +312,7 @@ func (self *cmdObjRunner) runAndDetectCredentialRequest(
return self.runAndStreamAux(cmdObj, func(handler *cmdHandler, cmdWriter io.Writer) {
tr := io.TeeReader(handler.stdoutPipe, cmdWriter)

go utils.Safe(func() {
self.processOutput(tr, handler.stdinPipe, promptUserForCredential, cmdObj.GetTask())
})
self.processOutput(tr, handler.stdinPipe, promptUserForCredential, cmdObj.GetTask())
})
}

Expand Down

0 comments on commit 1190f1b

Please sign in to comment.