From 0b990a9c31dad7c5ab953b00bc33dd246b8fe1b2 Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 20:09:32 +0000 Subject: [PATCH] Name the step's deadline, not a bound never set, when an unbounded command is cut (issue 1497) --- go/forgekey/runner.go | 5 ++++- go/forgekey/runner_test.go | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go/forgekey/runner.go b/go/forgekey/runner.go index bc8628c..8fe5040 100644 --- a/go/forgekey/runner.go +++ b/go/forgekey/runner.go @@ -56,7 +56,10 @@ func execRun(ctx context.Context, bound time.Duration, env []string, name string var exitErr *exec.ExitError switch { case errors.Is(ctx.Err(), context.DeadlineExceeded): - r.Status, r.Err = 124, fmt.Sprintf("no answer within %d s", int(bound/time.Second)) + r.Status, r.Err = 124, "ended by its step's deadline" + if bound > 0 { + r.Err = fmt.Sprintf("no answer within %d s", int(bound/time.Second)) + } case errors.Is(err, exec.ErrNotFound): r.Status, r.Err = 127, "ENOENT" case errors.As(err, &exitErr): diff --git a/go/forgekey/runner_test.go b/go/forgekey/runner_test.go index 8b94fd2..79f9825 100644 --- a/go/forgekey/runner_test.go +++ b/go/forgekey/runner_test.go @@ -36,6 +36,9 @@ func TestExecRunnerForZeroIsCutByItsContext(t *testing.T) { defer cancel() began := time.Now() r := ExecRunnerFor(0)(ctx, nil, "sleep", "2") + if r.Err != "ended by its step's deadline" { + t.Errorf("Err = %q, want the step's deadline named, not a bound that was never set", r.Err) + } if r.Status == 0 || time.Since(began) > time.Second { t.Errorf("ran = %+v after %v, want it cut", r, time.Since(began)) }