process_linux.go
func (p *setnsProcess) execSetns() error {
	err := p.cmd.Start()
	p.childPipe.Close()
	if err != nil {
		return newSystemError(err)
	}
	status, err := p.cmd.Process.Wait()
	if err != nil {
		p.cmd.Wait()
		return newSystemError(err)
	}
	if !status.Success() {
		p.cmd.Wait()
		return newSystemError(&exec.ExitError{ProcessState: status})
	}
	var pid *pid
	if err := json.NewDecoder(p.parentPipe).Decode(&pid); err != nil {
		p.cmd.Wait()
		return newSystemError(err)
	}

	process, err := os.FindProcess(pid.Pid)
	if err != nil {
		return err
	}

	p.cmd.Process = process
	return nil
}
func (p *setnsProcess) execSetns() error {
	err := p.cmd.Start()
	p.childPipe.Close()
	if err != nil {
		return newSystemError(err)
	}
	status, err := p.cmd.Process.Wait()
	if err != nil {
		p.cmd.Wait()
		return newSystemError(err)
	}
	if !status.Success() {
		p.cmd.Wait()
		return newSystemError(&exec.ExitError{ProcessState: status})
	}
	var pid *pid
	if err := json.NewDecoder(p.parentPipe).Decode(&pid); err != nil {
		p.cmd.Wait()
		return newSystemError(err)
	}

	process, err := os.FindProcess(pid.Pid)
	if err != nil {
		return err
	}

	p.cmd.Process = process
	return nil
}
func ( p * setnsProcess ) execSetns ( ) error { err := p . cmd . Start ( ) p . childPipe . Close ( ) if err != nil { return newSystemError ( err ) } status , err := p . cmd . Process . Wait ( ) if err != nil { p . cmd . Wait ( ) return newSystemError ( err ) } if ! status . Success ( ) { p . cmd . Wait ( ) return newSystemError ( & exec . ExitError { ProcessState : status } ) } var pid * pid if err := json . NewDecoder ( p . parentPipe ) . Decode ( & pid ) ; err != nil { p . cmd . Wait ( ) return newSystemError ( err ) } process , err := os . FindProcess ( pid . Pid ) if err != nil { return err } p . cmd . Process = process return nil }
// execSetns runs the process that executes C code to perform the setns calls
// because setns support requires the C process to fork off a child and perform the setns
// before the go runtime boots, we wait on the process to die and receive the child's pid
// over the provided pipe.
execSetns runs the process that executes C code to perform the setns calls because setns support requires the C process to fork off a child and perform the setns before the go runtime boots we wait on the process to die and receive the child s pid over the provided pipe .