term: add portability note re: std{in,out} fds

I recently made the mistake of assuming that stdin and stdout's
fds were 0 and 1, respectively, leading to a bug report from a
Windows user. With luck this note should prevent others from
making the same mistake.

Change-Id: I5391d91c431c3a801617f50d1b6a61121e2a939f
Reviewed-on: https://go-review.googlesource.com/c/term/+/349149
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
This commit is contained in:
Alan Donovan 2021-09-10 17:45:27 -04:00 коммит произвёл Carlos Amedee
Родитель 6886f2dfbf
Коммит 140adaaadf
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -12,6 +12,8 @@
// panic(err)
// }
// defer term.Restore(int(os.Stdin.Fd()), oldState)
//
// Note that on non-Unix systems os.Stdin.Fd() may not be 0.
package term
// State contains the state of a terminal.