Skip to content

Commit

Permalink
term: use stdin file descriptor in comment
Browse files Browse the repository at this point in the history
Using a `fd` of `0` on Windows will crash with `panic: The handle is invalid.`
By getting the file descriptor from `os.Stdin`, this can be avoided.

Change-Id: Ie7915b1e0e1018fcb92b6ba006fe85a9aee439ad
GitHub-Last-Rev: 4e56574
GitHub-Pull-Request: #3
Reviewed-on: https://go-review.googlesource.com/c/term/+/280232
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Tobias Klauser <[email protected]>
  • Loading branch information
makew0rld authored and tklauser committed Mar 17, 2021
1 parent 6a3ed07 commit de623e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions term.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
//
// Putting a terminal into raw mode is the most common requirement:
//
// oldState, err := term.MakeRaw(0)
// oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
// if err != nil {
// panic(err)
// }
// defer term.Restore(0, oldState)
// defer term.Restore(int(os.Stdin.Fd()), oldState)
package term

// State contains the state of a terminal.
Expand Down

0 comments on commit de623e6

Please sign in to comment.