Skip to content
Myr

become: Set stdin to /dev/tty

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 9e9c0ce · Browse files · 3 files+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−0 removed

  • other:+11 added−0 removed

3 files+11 added−0 removed

modified:src/util/util_unix.go+6 added
4 unmodified lines
5import (6 "os"7 "os/exec"8 "syscall"910 "golang.org/x/sys/unix"11)1213// ExecCommand executes the given command with $SHELL14func ExecCommand(command string, setpgid bool) *exec.Cmd {
31 unmodified lines
46// Read executes syscall.Read on file descriptor47func Read(fd int, b []byte) (int, error) {48 return syscall.Read(int(fd), b)49}5051func SetStdin(file *os.File) {52 unix.Dup2(int(file.Fd()), 0)53}
modified:src/util/util_windows.go+4 added
79 unmodified lines
80// Read executes syscall.Read on file descriptor81func Read(fd int, b []byte) (int, error) {82 return syscall.Read(syscall.Handle(fd), b)83}8485func SetStdin(file *os.File) {86 // No-op87}
modified:src/terminal.go+1 added
2874 unmodified lines
2875 t.tui.Close()2876 if t.history != nil {2877 t.history.append(string(t.input))2878 }2879 util.SetStdin(tui.TtyIn())2880 syscall.Exec(shellPath, []string{shell, "-c", command}, os.Environ())2881 }2882 }2883 case actExecute, actExecuteSilent:
709 unmodified lines