mirror of
https://github.com/creack/pty.git
synced 2026-04-01 02:57:06 +09:00
Don't set Stdin/Stdout/Stderr if already set (#71)
* only set stdout and stderr if not already set * Don't set cmd.Stdin if it's already set Considered @craek's codereview
This commit is contained in:
committed by
Guillaume J. Charmes
parent
7dc38fb350
commit
521317be5e
12
run.go
12
run.go
@@ -33,9 +33,15 @@ func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
c.Stdout = tty
|
||||
c.Stdin = tty
|
||||
c.Stderr = tty
|
||||
if c.Stdout == nil {
|
||||
c.Stdout = tty
|
||||
}
|
||||
if c.Stderr == nil {
|
||||
c.Stderr = tty
|
||||
}
|
||||
if c.Stdin == nil {
|
||||
c.Stdin = tty
|
||||
}
|
||||
if c.SysProcAttr == nil {
|
||||
c.SysProcAttr = &syscall.SysProcAttr{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user