From 5ad08fd3b3f8d8c0328bb458dc641fe36690a66c Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Thu, 29 Nov 2018 18:28:30 -0800 Subject: [PATCH] tty state restored prior to printing nonzero exit status for interactive shell sessions Signed-off-by: Russ Magee --- hkexsh/hkexsh.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index f32d0be..065dc5c 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -697,7 +697,6 @@ func main() { fmt.Fprintln(os.Stderr, rejectUserMsg()) // nolint: errcheck rec.SetStatus(255) } else { - // Set up chaffing to server conn.SetupChaff(chaffFreqMin, chaffFreqMax, chaffBytesMax) // enable client->server chaffing if chaffEnabled { @@ -729,6 +728,7 @@ func main() { } 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 } }