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 using `os.Symlink` instead of `os.Link`..

See #200
  • Loading branch information
bep committed May 4, 2023
1 parent 22b9127 commit 68c86dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion testscript/exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ func RunMain(m TestingM, commands map[string]func() int) (exitCode int) {
// as that can lead to "access denied" errors when removing.
func copyBinary(from, to string) error {
if runtime.GOOS != "windows" {
if err := os.Link(from, to); err == nil {
// Note: We used to use os.Link here, but there were
// "signal: killed" unexpected command failure type of errors on newer MacOS versions.
// Testing this show that os.Symlink works on MacOS without the above issue.
if err := os.Symlink(from, to); err == nil {
return nil
}
}
Expand Down

0 comments on commit 68c86dc

Please sign in to comment.