diff options
Diffstat (limited to 'src/syscall/exec_darwin.go')
| -rw-r--r-- | src/syscall/exec_darwin.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/syscall/exec_darwin.go b/src/syscall/exec_darwin.go index 9f7bf67d2c..ac1ead3a2b 100644 --- a/src/syscall/exec_darwin.go +++ b/src/syscall/exec_darwin.go @@ -160,22 +160,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } } - // Detach fd 0 from tty - if sys.Noctty { - _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0) - if err1 != 0 { - goto childerror - } - } - - // Set the controlling TTY to Ctty - if sys.Setctty { - _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) - if err1 != 0 { - goto childerror - } - } - // Pass 1: look for fd[i] < i and move those up above len(fd) // so that pass 2 won't stomp on an fd it needs later. if pipe < nextfd { @@ -233,6 +217,22 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0) } + // Detach fd 0 from tty + if sys.Noctty { + _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0) + if err1 != 0 { + goto childerror + } + } + + // Set the controlling TTY to Ctty + if sys.Setctty { + _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) + if err1 != 0 { + goto childerror + } + } + // Time to exec. _, _, err1 = rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(argv0)), |
