Exemple #1
0
// 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
}
Exemple #2
0
func (x XValve) Recv() (circuit.X, error) {
	r, err := x.Valve.Recv()
	if err != nil {
		return nil, errors.Pack(err)
	}
	return xio.NewXReadCloser(r), nil
}
Exemple #3
0
func (x XServer) Profile(name string) (circuit.X, error) {
	r, err := x.server.Profile(name)
	if err != nil {
		return nil, errors.Pack(err)
	}
	return xio.NewXReadCloser(r), nil
}
Exemple #4
0
func (x XContainer) Stderr() circuit.X {
	return xio.NewXReadCloser(x.Container.Stderr())
}
Exemple #5
0
func (x XProc) Stderr() circuit.X {
	return xio.NewXReadCloser(x.Proc.Stderr())
}