summaryrefslogtreecommitdiff
path: root/libgo/go/os/exec_posix.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/exec_posix.go')
-rw-r--r--libgo/go/os/exec_posix.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libgo/go/os/exec_posix.go b/libgo/go/os/exec_posix.go
index bb47e8330c7..a944e4e0350 100644
--- a/libgo/go/os/exec_posix.go
+++ b/libgo/go/os/exec_posix.go
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build aix darwin dragonfly freebsd hurd js,wasm linux nacl netbsd openbsd solaris windows
+// +build aix darwin dragonfly freebsd hurd js,wasm linux netbsd openbsd solaris windows
package os
import (
+ "runtime"
"syscall"
)
@@ -49,9 +50,14 @@ func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err e
}
pid, h, e := syscall.StartProcess(name, argv, sysattr)
+
+ // Make sure we don't run the finalizers of attr.Files.
+ runtime.KeepAlive(attr)
+
if e != nil {
return nil, &PathError{"fork/exec", name, e}
}
+
return newProcess(pid, h), nil
}