From: qmuntal Date: Fri, 23 Jun 2023 10:44:15 +0000 (+0200) Subject: syscall: clarify which handles are affected by SysProcAttr.NoInheritHandles X-Git-Tag: go1.21rc3~2^2~52 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8008c0840ff09c492434e67de443ee478957fb8f;p=gostls13.git syscall: clarify which handles are affected by SysProcAttr.NoInheritHandles SysProcAttr.NoInheritHandles doc comment is not clear about which handles are affected by it. This CL clarifies that it not only affects the ones passed in AdditionalInheritedHandles, but also the ones passed in ProcAttr.Files, which are required to be stderr, stdin and stdout when calling syscall.StartProcess. Updates #60942 Change-Id: I5bc5b3604b6db04b83f6764d5c5ffbdafeeb22fb Reviewed-on: https://go-review.googlesource.com/c/go/+/505515 Run-TryBot: Quim Muntal Reviewed-by: Bryan Mills Reviewed-by: Carlos Amedee TryBot-Result: Gopher Robot --- diff --git a/src/syscall/exec_windows.go b/src/syscall/exec_windows.go index 45295dedff..0a93bc0a80 100644 --- a/src/syscall/exec_windows.go +++ b/src/syscall/exec_windows.go @@ -247,7 +247,7 @@ type SysProcAttr struct { Token Token // if set, runs new process in the security context represented by the token ProcessAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process ThreadAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process - NoInheritHandles bool // if set, each inheritable handle in the calling process is not inherited by the new process + NoInheritHandles bool // if set, no handles are inherited by the new process, not even the standard handles, contained in ProcAttr.Files, nor the ones contained in AdditionalInheritedHandles AdditionalInheritedHandles []Handle // a list of additional handles, already marked as inheritable, that will be inherited by the new process ParentProcess Handle // if non-zero, the new process regards the process given by this handle as its parent process, and AdditionalInheritedHandles, if set, should exist in this parent process }