diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index 366f0cb..ac7d0cc 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -298,7 +298,7 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { exitStatus = uint32(status.ExitStatus()) fmt.Print(stdErrBuffer) - fmt.Printf("Exit Status: %d\n", exitStatus) //# + //fmt.Printf("Exit Status: %d\n", exitStatus) //# } } } @@ -367,7 +367,7 @@ func doCopyMode(conn *hkexnet.Conn, remoteDest bool, files string, rec *hkexsh.S // an ExitStatus() method with the same signature. if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { exitStatus = uint32(status.ExitStatus()) - log.Printf("Exit Status: %d", exitStatus) + //log.Printf("Exit Status: %d", exitStatus) } } } diff --git a/termmode_unix.go b/termmode_unix.go index 8bcb60a..e1b4cd1 100644 --- a/termmode_unix.go +++ b/termmode_unix.go @@ -3,6 +3,7 @@ package hkexsh import ( + "errors" "io" unix "golang.org/x/sys/unix" @@ -67,7 +68,11 @@ func GetState(fd int) (*State, error) { // Restore restores the terminal connected to the given file descriptor to a // previous state. func Restore(fd int, state *State) error { - return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) + if state != nil { + return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) + } else { + return errors.New("nil State") + } } // ReadPassword reads a line of input from a terminal without local echo. This