aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2022-10-01 12:08:17 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-03 20:29:42 +0000
commit29c8cac9d0a133b96d213e28bb277f539582627b (patch)
tree27c8fb2291af29b65ef9e7c81682a675dd4eb47d
parent8f7a10dd9cfe029803059de4043cf9ceb30c83ff (diff)
downloadtoolchain-utils-29c8cac9d0a133b96d213e28bb277f539582627b.tar.gz
command: fix flaky test
If `exec` times out, we need to wrap the error it died with, rather than embedding it in another error. This allows `TestRunWithTimeoutReturnsErrorOnTimeout`'s `errors.Is` to correctly detect that `err` is a `context.DeadlineExceeded`. BUG=None TEST=ran this test 1000x Change-Id: I69e0dcea25dfd0cb01ac5ec0a2e8ce2f116deff7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3932869 Auto-Submit: George Burgess <gbiv@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
-rw-r--r--compiler_wrapper/command.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler_wrapper/command.go b/compiler_wrapper/command.go
index 20e11bbb..e2a5176d 100644
--- a/compiler_wrapper/command.go
+++ b/compiler_wrapper/command.go
@@ -76,7 +76,7 @@ func runCmdWithTimeout(env env, cmd *command, t time.Duration) error {
cmdCtx.Stderr = env.stderr()
if err := cmdCtx.Start(); err != nil {
- return newErrorwithSourceLocf("exec error: %v", err)
+ return fmt.Errorf("exec error: %w", err)
}
err := cmdCtx.Wait()
if ctx.Err() == nil {