summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-10 17:11:22 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-10 17:12:34 +1000
commit90613056cef95fe32d19198d88a0d71f00c5f6ae (patch)
tree315c9eb8cb92bcbbd08081dff215f8a2cf10825b
parentc05a1ae71197d95038add5aef3a16dccc3c851d4 (diff)
Fix flakey pull_merge_conflict test
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.
-rw-r--r--pkg/commands/oscommands/cmd_obj_runner.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/commands/oscommands/cmd_obj_runner.go b/pkg/commands/oscommands/cmd_obj_runner.go
index 6dcb16b89..3456bcd9e 100644
--- a/pkg/commands/oscommands/cmd_obj_runner.go
+++ b/pkg/commands/oscommands/cmd_obj_runner.go
@@ -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
@@ -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())
})
}