Exit is stdin is not a tty

pull/14/merge
Vasile Popescu 4 years ago
parent 786f47b105
commit 6fc776b924

@ -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