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: 4e56574120c1a5351f180f3290bc9407f3d6976f 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>
diff --git a/term.go b/term.go index 2a4ccf8..1f6a38f 100644 --- a/term.go +++ b/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.