Compare commits

...

1 Commits

Author SHA1 Message Date
Vasile Popescu 793f21ab9b Exit if stdin is not a tty 4 years ago

@ -45,7 +45,10 @@ func main() {
log.Out = logFile
}
// TODO: check we are running inside a tty environment, and exit if not
if !isStdinTerminal() {
fmt.Printf("Input not a tty\n")
os.Exit(1)
}
var rawConnection io.ReadWriteCloser
if *useTLS {

@ -26,6 +26,10 @@ func ptyMasterNew() *ptyMaster {
return &ptyMaster{}
}
func isStdinTerminal() bool {
return terminal.IsTerminal(0)
}
func (pty *ptyMaster) Start(command string, args []string, winChangedCB onWindowChangesCB) (err error) {
pty.windowChangedCB = winChangedCB

Loading…
Cancel
Save