From 90613056cef95fe32d19198d88a0d71f00c5f6ae Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 10 Jul 2023 17:11:22 +1000 Subject: [PATCH] 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. --- pkg/commands/oscommands/cmd_obj_runner.go | 10 ++++++---- 1 file 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()) }) }