diff options
Diffstat (limited to 'src/util/util_unix.go')
-rw-r--r-- | src/util/util_unix.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/util_unix.go b/src/util/util_unix.go index a76f770a..2991fd2c 100644 --- a/src/util/util_unix.go +++ b/src/util/util_unix.go @@ -6,6 +6,8 @@ import ( "os" "os/exec" "syscall" + + "golang.org/x/sys/unix" ) // ExecCommand executes the given command with $SHELL @@ -45,3 +47,7 @@ func SetNonblock(file *os.File, nonblock bool) { func Read(fd int, b []byte) (int, error) { return syscall.Read(int(fd), b) } + +func SetStdin(file *os.File) { + unix.Dup2(int(file.Fd()), 0) +} |