mirror of
https://github.com/golang/term.git
synced 2026-01-29 15:12:09 +03:00
term: use stdin file descriptor in comment
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: 4e56574120
GitHub-Pull-Request: golang/term#3
Reviewed-on: https://go-review.googlesource.com/c/term/+/280232
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
committed by
Tobias Klauser
parent
6a3ed077a4
commit
de623e64d2
4
term.go
4
term.go
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user