tty state restored prior to printing nonzero exit status for interactive shell sessions

Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
Russ Magee 2018-11-29 18:28:30 -08:00
parent b4672deded
commit 5ad08fd3b3

View file

@ -697,7 +697,6 @@ func main() {
fmt.Fprintln(os.Stderr, rejectUserMsg()) // nolint: errcheck fmt.Fprintln(os.Stderr, rejectUserMsg()) // nolint: errcheck
rec.SetStatus(255) rec.SetStatus(255)
} else { } else {
// Set up chaffing to server // Set up chaffing to server
conn.SetupChaff(chaffFreqMin, chaffFreqMax, chaffBytesMax) // enable client->server chaffing conn.SetupChaff(chaffFreqMin, chaffFreqMax, chaffBytesMax) // enable client->server chaffing
if chaffEnabled { if chaffEnabled {
@ -729,6 +728,7 @@ func main() {
} }
if rec.Status() != 0 { if rec.Status() != 0 {
_ = hkexsh.Restore(int(os.Stdin.Fd()), oldState) // nolint: errcheck,gosec
fmt.Fprintln(os.Stderr, "Session exited with status:", rec.Status()) // nolint: errcheck fmt.Fprintln(os.Stderr, "Session exited with status:", rec.Status()) // nolint: errcheck
} }
} }