Skip to content

Commit

Permalink
client/client.go: windows sucks
Browse files Browse the repository at this point in the history
you can make things raw, but sometimes, you can't get the
window size.

Signed-off-by: Ronald G Minnich <[email protected]>
  • Loading branch information
rminnich committed Nov 27, 2023
1 parent 83e883d commit 92ecf10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ func Command(host string, args ...string) *Cmd {
col, row := 80, 40
if c, r, err := term.GetSize(int(os.Stdin.Fd())); err != nil {
verbose("Can not get winsize: %v; assuming %dx%d and non-interactive", err, col, row)
// ah, windows. You suck.
oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
if err == nil {
hasTTY = true
}
term.Restore(int(os.Stdin.Fd()), oldState)
} else {
hasTTY = true
col, row = c, r
Expand Down

0 comments on commit 92ecf10

Please sign in to comment.