MCPcopy
hub / github.com/opencontainers/runc / getChildPid

Method getChildPid

libcontainer/process_linux.go:636–651  ·  view source on GitHub ↗

getChildPid receives the final child's pid over the provided pipe.

()

Source from the content-addressed store, hash-verified

634
635// getChildPid receives the final child's pid over the provided pipe.
636func (p *initProcess) getChildPid() (int, error) {
637 var pid pid
638 if err := json.NewDecoder(p.comm.initSockParent).Decode(&pid); err != nil {
639 _ = p.cmd.Wait()
640 return -1, err
641 }
642
643 // Clean up the zombie parent process
644 // On Unix systems FindProcess always succeeds.
645 firstChildProcess, _ := os.FindProcess(pid.PidFirstChild)
646
647 // Ignore the error in case the child has already been reaped for any reason
648 _, _ = firstChildProcess.Wait()
649
650 return pid.Pid, nil
651}
652
653func (p *initProcess) waitForChildExit(childPid int) error {
654 status, err := p.cmd.Process.Wait()

Callers 1

startMethod · 0.95

Calls 1

WaitMethod · 0.80

Tested by

no test coverage detected