func (r *RunParams) Wait() (*ExecResponse, error) {
	var err error
	if r.ps == nil {
		return nil, errors.New("No process has been started yet")
	}
	err = r.ps.Wait()
	if err := os.RemoveAll(r.tempDir); err != nil {
		logger.Warningf("failed to remove temporary directory: %v", err)
	}

	result := &ExecResponse{
		Stdout: r.stdout.Bytes(),
		Stderr: r.stderr.Bytes(),
	}

	if ee, ok := err.(*exec.ExitError); ok && err != nil {
		status := ee.ProcessState.Sys().(syscall.WaitStatus)
		if status.Exited() {
			// A non-zero return code isn't considered an error here.
			result.Code = status.ExitStatus()
			err = nil
		}
		logger.Infof("run result: %v", ee)
	}
	return result, err
}
// Wait blocks until the process exits, and returns an ExecResponse type
// containing stdout, stderr and the return code of the process. If a non-zero
// return code is returned, this is collected as the code for the response and
// this does not classify as an error.
Wait blocks until the process exits, and returns an ExecResponse type
containing stdout, stderr and the return code of the process. If a non-zero
return code is returned, this is collected as the code for the response and
this does not classify as an error.
// Wait blocks until the process exits and returns an ExecResponse type // containing stdout stderr and the return code of the process . If a non - zero // return code is returned this is collected as the code for the response and // this does not classify as an error .
func (r *RunParams) Wait() (*ExecResponse, error) {
	var err error
	if r.ps == nil {
		return nil, errors.New("No process has been started yet")
	}
	err = r.ps.Wait()
	if err := os.RemoveAll(r.tempDir); err != nil {
		logger.Warningf("failed to remove temporary directory: %v", err)
	}
	result := &ExecResponse{
		Stdout: r.stdout.Bytes(),
		Stderr: r.stderr.Bytes(),
	}
	if ee, ok := err.(*exec.ExitError); ok && err != nil {
		status := ee.ProcessState.Sys().(syscall.WaitStatus)
		if status.Exited() {
			result.Code = status.ExitStatus()
			err = nil
		}
		logger.Infof("run result: %v", ee)
	}
	return result, err
}
func ( r * RunParams ) Wait ( ) ( * ExecResponse , error ) { var err error if r . ps == nil { return nil , errors . New ( " " ) } err = r . ps . Wait ( ) if err := os . RemoveAll ( r . tempDir ) ; err != nil { logger . Warningf ( " " , err ) } result := & ExecResponse { Stdout : r . stdout . Bytes ( ) , Stderr : r . stderr . Bytes ( ) , } if ee , ok := err . ( * exec . ExitError ) ; ok && err != nil { status := ee . ProcessState . Sys ( ) . ( syscall . WaitStatus ) if status . Exited ( ) { result . Code = status . ExitStatus ( ) err = nil } logger . Infof ( " " , ee ) } return result , err }
Wait blocks until the process exits, and returns an ExecResponse type
containing stdout, stderr and the return code of the process.
Wait blocks until the process exits and returns an ExecResponse type containing stdout stderr and the return code of the process .
// A non-zero return code isn't considered an error here.