Skip to content

Commit

Permalink
connect: fix work with terminal
Browse files Browse the repository at this point in the history
The patch adds a workaround for the bug "Terminal does
not display command after go-prompt exit"
(c-bata/go-prompt#228).

Part of #15
  • Loading branch information
LeonidVas committed Apr 20, 2022
1 parent 199a1ee commit f1111a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/connect/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit f1111a9

Please sign in to comment.