1
0
mirror of https://github.com/golang/go synced 2024-11-19 10:14:44 -07:00

os: document inheritance of thread state over exec

Fixes #23570.

Change-Id: I462ada2960d710c2c94dc22a59d292703d83f612
Reviewed-on: https://go-review.googlesource.com/90255
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Austin Clements 2018-01-26 13:44:28 -05:00
parent b5b35be2b8
commit 3ee8c3cc0b
2 changed files with 10 additions and 0 deletions

View File

@ -88,6 +88,11 @@ func FindProcess(pid int) (*Process, error) {
// specified by name, argv and attr. The argv slice will become os.Args in the // specified by name, argv and attr. The argv slice will become os.Args in the
// new process, so it normally starts with the program name. // new process, so it normally starts with the program name.
// //
// If the calling goroutine has locked the operating system thread
// with runtime.LockOSThread and modified any inheritable OS-level
// thread state (for example, Linux or Plan 9 name spaces), the new
// process will inherit the caller's thread state.
//
// StartProcess is a low-level interface. The os/exec package provides // StartProcess is a low-level interface. The os/exec package provides
// higher-level interfaces. // higher-level interfaces.
// //

View File

@ -293,6 +293,11 @@ func (c *Cmd) closeDescriptors(closers []io.Closer) {
// //
// If the command starts but does not complete successfully, the error is of // If the command starts but does not complete successfully, the error is of
// type *ExitError. Other error types may be returned for other situations. // type *ExitError. Other error types may be returned for other situations.
//
// If the calling goroutine has locked the operating system thread
// with runtime.LockOSThread and modified any inheritable OS-level
// thread state (for example, Linux or Plan 9 name spaces), the new
// process will inherit the caller's thread state.
func (c *Cmd) Run() error { func (c *Cmd) Run() error {
if err := c.Start(); err != nil { if err := c.Start(); err != nil {
return err return err