From a58a5d5506e60b1b491c59c4e15eaaa7995fb551 Mon Sep 17 00:00:00 2001 From: Vishwanath Hiremath <100623239+vishwahiremat@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:55:01 -0700 Subject: [PATCH] Adding Fix for flakey test caused while buildng bicep template (#7345) # Description Added changes to sequentialy copy the stdout to buffer instead of copying it asynchronously. ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). Fixes: https://github.com/radius-project/radius/issues/7194 Signed-off-by: Vishwanath Hiremath --- pkg/cli/bicep/build.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/cli/bicep/build.go b/pkg/cli/bicep/build.go index 8f7c475d6f..82427e9d74 100644 --- a/pkg/cli/bicep/build.go +++ b/pkg/cli/bicep/build.go @@ -59,12 +59,10 @@ func runBicepRaw(args ...string) ([]byte, error) { return nil, fmt.Errorf("failed executing %q: %w", fullCmd, err) } - // asynchronously copy to our buffer, we don't really need to observe + // copy to our buffer, we don't really need to observe // errors here since it's copying into memory buf := bytes.Buffer{} - go func() { - _, _ = io.Copy(&buf, stdout) - }() + _, _ = io.Copy(&buf, stdout) // Wait() will wait for us to finish draining stderr before returning the exit code err = c.Wait()