From 140adaaadfafb2472e71699e7e2ab905c865114b Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Fri, 10 Sep 2021 17:45:27 -0400 Subject: [PATCH] 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 Trust: Carlos Amedee --- term.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/term.go b/term.go index 1f6a38f..d592708 100644 --- a/term.go +++ b/term.go @@ -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.