From c69664a0d45cbfcaf43de05e616c446ad069be4c Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Mon, 13 Aug 2018 17:28:27 +0100 Subject: [PATCH] try to fix darwin pty --- pty/pty_darwin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pty/pty_darwin.go b/pty/pty_darwin.go index 3b5f074..12dabca 100644 --- a/pty/pty_darwin.go +++ b/pty/pty_darwin.go @@ -39,7 +39,11 @@ func open() (*os.File, *os.File, error) { } func getpt() (file *os.File, err error) { - return os.OpenFile("/dev/ptmx", os.O_RDWR, 0) + f, err := os.OpenFile("/dev/ptmx", os.O_RDWR|syscall.O_CLOEXEC, 0) + if err != nil { + return nil, err + } + return os.NewFile(uintptr(f), "/dev/ptmx"), nil } func ptsname(file *os.File) (name string, err error) {