// Start starts the command and returns cross-interfaces to its standard input, output and error. func (x *XCmd) Start() (xstdin circuit.X, xstdout, xstderr circuit.X, err error) { // stdin, err := x.cmd.StdinPipe() if err != nil { return nil, nil, nil, err } // stdout, err := x.cmd.StdoutPipe() if err != nil { return nil, nil, nil, err } // stderr, err := x.cmd.StderrPipe() if err != nil { return nil, nil, nil, err } // if err = x.cmd.Start(); err != nil { return nil, nil, nil, err } defer func() { go x.cmd.Wait() // Calling wait is necessary, otherwise child remains zombie }() return xyio.NewXWriteCloser(stdin), xyio.NewXReadCloser(stdout), xyio.NewXReadCloser(stderr), nil }
func (x XValve) Send() (circuit.X, error) { w, err := x.Valve.Send() if err != nil { return nil, errors.Pack(err) } return xio.NewXWriteCloser(w), nil }
func (x XContainer) Stdin() circuit.X { return xio.NewXWriteCloser(x.Container.Stdin()) }
func (x XProc) Stdin() circuit.X { return xio.NewXWriteCloser(x.Proc.Stdin()) }