From a8c6c4837c17ab4ec3ba78e40b9a72dc70d9cf5a Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <iant@golang.org>
Date: Wed, 8 Jun 2016 21:09:09 -0700
Subject: [PATCH] os: document that the runtime can write to standard error

Fixes #15970.

Change-Id: I3f7d8316069a69d0e3859aaa96bc1414487fead0
Reviewed-on: https://go-review.googlesource.com/23921
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
---
 src/os/file.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/os/file.go b/src/os/file.go
index 74d3c9f9631..e546441497b 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -46,6 +46,10 @@ func (f *File) Name() string { return f.name }
 
 // Stdin, Stdout, and Stderr are open Files pointing to the standard input,
 // standard output, and standard error file descriptors.
+//
+// Note that the Go runtime writes to standard error for panics and crashes;
+// closing Stderr may cause those messages to go elsewhere, perhaps
+// to a file opened later.
 var (
 	Stdin  = NewFile(uintptr(syscall.Stdin), "/dev/stdin")
 	Stdout = NewFile(uintptr(syscall.Stdout), "/dev/stdout")
-- 
GitLab