From 45fed99267879c35c3abfbc96ce1e5181b7ac411 Mon Sep 17 00:00:00 2001 From: connerdouglass Date: Sat, 27 Apr 2024 14:18:08 -0400 Subject: [PATCH] fix: wait for logs to collect before exiting runner --- runner.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runner.go b/runner.go index d6a6eea..501aa93 100644 --- a/runner.go +++ b/runner.go @@ -129,10 +129,13 @@ func (p *implRunner) Run(ctx context.Context) error { } // Wait for the process to end - if err := cmd.Wait(); err != nil { - // Wait for the error log to finish - wg.Wait() + err = cmd.Wait() + // Wait for the error log to finish + wg.Wait() + + // If the process errored, return the error + if err != nil { // If the context triggered the process to be killed, we want to see the context's error // instead of the process's error if ctx != nil && ctx.Err() != nil {