Skip to content

Commit

Permalink
os: document inheritance of thread state over exec
Browse files Browse the repository at this point in the history
Fixes #23570.

Change-Id: I462ada2960d710c2c94dc22a59d292703d83f612
Reviewed-on: https://go-review.googlesource.com/90255
Reviewed-by: Russ Cox <[email protected]>
  • Loading branch information
aclements committed Jan 26, 2018
1 parent b5b35be commit 3ee8c3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/os/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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
// higher-level interfaces.
//
Expand Down
5 changes: 5 additions & 0 deletions src/os/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ func (c *Cmd) closeDescriptors(closers []io.Closer) {
//
// If the command starts but does not complete successfully, the error is of
// 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 {
if err := c.Start(); err != nil {
return err
Expand Down

0 comments on commit 3ee8c3c

Please sign in to comment.