Skip to content

Commit

Permalink
testscript: fix "signal: killed" exec errors
Browse files Browse the repository at this point in the history
By adding a small sleep before `TestingM.Run()` to allow the write of the test commands to be flushed to disk.

Fixes rogpeppe#200
  • Loading branch information
bep committed May 2, 2023
1 parent 22b9127 commit 3437fa6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testscript/exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path/filepath"
"runtime"
"strings"
"time"
)

// TestingM is implemented by *testing.M. It's defined as an interface
Expand Down Expand Up @@ -97,6 +98,10 @@ func RunMain(m TestingM, commands map[string]func() int) (exitCode int) {
ts.cmdExec(neg, append([]string{name}, args...))
}
}

// Make sure all of the io operations above gets some time to complete.
time.Sleep(50 * time.Millisecond)

return m.Run()
}
// The command being registered is being invoked, so run it, then exit.
Expand Down

0 comments on commit 3437fa6

Please sign in to comment.