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).
  • Loading branch information
LeonidVas committed Apr 20, 2022
1 parent b4ed1a2 commit 6eaba25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Bug that caused a typed command not to be displayed on the terminal after
exiting the "connect" console.

## [2.12.0] - 2022-03-30

### Changed
Expand Down
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 @@ -134,6 +135,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 6eaba25

Please sign in to comment.