From acec1f3963933eb541e96d3faff41e6bc97068b6 Mon Sep 17 00:00:00 2001 From: Leonid Vasiliev Date: Thu, 14 Apr 2022 17:52:24 +0300 Subject: [PATCH] connect: fix work with terminal The patch adds a workaround for the bug "Terminal does not display command after go-prompt exit" (https://github.com/c-bata/go-prompt/issues/228). Part of #15 --- cli/connect/console.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/connect/console.go b/cli/connect/console.go index 209aff368..6c570873d 100644 --- a/cli/connect/console.go +++ b/cli/connect/console.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "os" + "os/exec" "path/filepath" "sort" "strings" @@ -128,6 +129,12 @@ func (console *Console) Run() error { console.prompt.Run() + // Sets the terminal modes to “sane” values to workaround + // bug https://github.com/c-bata/go-prompt/issues/228 + sttySane := exec.Command("stty", "sane") + sttySane.Stdin = os.Stdin + _ = sttySane.Run() + return nil }