src/server/pkg/exec/exec.go
func (c *Cmd) WaitIO(state *os.ProcessState, err error) (retErr error) {
	if c.waitDone != nil {
		close(c.waitDone)
	}
	c.ProcessState = state
	if err != nil {
		return err
	} else if !state.Success() {
		return &ExitError{ProcessState: state}
	}
	for range c.goroutine {
		if err := <-c.errch; err != nil && retErr == nil {
			retErr = err
		}
	}
	c.closeDescriptors(c.closeAfterWait)
	return retErr
}
func (c *Cmd) WaitIO(state *os.ProcessState, err error) (retErr error) {
	if c.waitDone != nil {
		close(c.waitDone)
	}
	c.ProcessState = state
	if err != nil {
		return err
	} else if !state.Success() {
		return &ExitError{ProcessState: state}
	}
	for range c.goroutine {
		if err := <-c.errch; err != nil && retErr == nil {
			retErr = err
		}
	}
	c.closeDescriptors(c.closeAfterWait)
	return retErr
}
// WaitIO is a helper function and the reason we forked this
// package from stdlib. This way, we can manually close IO when
// c.Process.Wait() has already been called once