From 30b148c8d481f5d0b08aa15540b4f685776c58bc Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 17 May 2019 11:52:36 -0400 Subject: [PATCH] Restore tty start before emitting errors Otherwise, the error message appears indented unexpectedly. --- command/alloc_exec.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/alloc_exec.go b/command/alloc_exec.go index 0f93f408f..6dd845edb 100644 --- a/command/alloc_exec.go +++ b/command/alloc_exec.go @@ -265,6 +265,11 @@ func (l *AllocExecCommand) execImpl(client *api.Client, alloc *api.Allocation, t stdin = escapingio.NewReader(stdin, escapeChar[0], func(c byte) bool { switch c { case '.': + // need to restore tty state so error reporting here + // gets emitted at beginning of line + outCleanup() + inCleanup() + stderr.Write([]byte("\nConnection closed\n")) cancelFn() return true @@ -272,7 +277,6 @@ func (l *AllocExecCommand) execImpl(client *api.Client, alloc *api.Allocation, t return false } }) - } }