Skip to content

Commit

Permalink
testscript: fix "signal: killed" exec errors on MacOS
Browse files Browse the repository at this point in the history
By doing a full copy and not a hard link of the binaries.

This is the fall back used already for Windows.

This is tested OK to remove unexpected test failures with error output similar to:

```
[signal: killed]
FAIL: testscripts/myecho.txt:1: unexpected command failure
```

See #200
  • Loading branch information
bep committed May 3, 2023
1 parent 22b9127 commit 34d7f75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion testscript/exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ func RunMain(m TestingM, commands map[string]func() int) (exitCode int) {
// unix-like setups. Note that "go test" also places test binaries in the
// system's temporary directory, like we do. We don't use hard links on Windows,
// as that can lead to "access denied" errors when removing.
// We also currently don't use hard links on macOS, see issue #200.
func copyBinary(from, to string) error {
if runtime.GOOS != "windows" {
if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
if err := os.Link(from, to); err == nil {
return nil
}
Expand Down

0 comments on commit 34d7f75

Please sign in to comment.