Run command with arguments. Wait for command to complete. If the
        exit code was as expected and there is no exception then return,
        otherwise raise EasyProcessError.

        :param return_code: int, expected return code
        :rtype: self
977390
def check(self, return_code=0):
        
        ret = self.call().return_code
        ok = ret == return_code
        if not ok:
            raise EasyProcessError(
                self, 'check error, return code is not {0}!'.format(return_code))
        return self
1327911
def check_returncode(self):
        """"""
        if self.returncode:
            raise CalledProcessError(self.returncode, self.args, self.stdout,
                                     self.stderr)
364715
def call(cmd, input=None, assert_zero_exit_status=True, warn_on_non_zero_exist_status=False, **kwargs):
    
    if (not kwargs.get('shell')) and isinstance(cmd, basestring):
        raise ValueError('cmd should be list or tuple, not a string: %r' % cmd)
    result = SubprocessResult.call(cmd, input=input, **kwargs)
    if assert_zero_exit_status and result.ret != 0:
        raise SubprocessError(result)

    if warn_on_non_zero_exist_status and result.ret != 0:
        logger.warn('subprocess failed %r' % result)

    return result
930399
def execute(self, command):
        '''
        
        '''
        process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
        while True:
            if process.poll() is not None:
                self.returncode = process.returncode  # pylint: disable=W0201
                break
            yield process.stdout.readline()
875319
def run(command, exit, silent, check):
    

    status = 0

    for (repo, path) in gather_repositories():
        if check and not check_repo(repo, path):
            status = 1

            if exit:
                break

            continue

        with chdir(path):
            result = subprocess.run(command, shell=True, capture_output=silent)
            if result.returncode != 0:
                status = result.returncode

                print('Command failed: {}'.format(repo))

                if exit:
                    break

    sys.exit(status)
476469
def getExitCode(self, command, env={}, path=None, uid=None, gid=None,
                    usePTY=0, childFDs=None):
        
        deferred = defer.Deferred()
        processProtocol = _SummaryProcessProtocol(deferred)
        self.execute(processProtocol, command, env, path, uid, gid,
                     usePTY, childFDs)
        @deferred.addCallback
        def getStdOut(tuple_):
            _stdout, _stderr, exitCode = tuple_
            return exitCode
        return deferred
1256279
def run(self, command, env={}, path=None,
            uid=None, gid=None, usePTY=0, childFDs=None):
        
        deferred = defer.Deferred()
        processProtocol = _SummaryProcessProtocol(deferred)
        d = defer.maybeDeferred(self.execute, processProtocol, command, env,
                                path, uid, gid, usePTY, childFDs)
        d.addErrback(deferred.errback)
        return deferred
494614
def run(command, show=True, *args, **kwargs):
    
    if show:
        print_command(command)
    with hide("running"):
        return _run(command, *args, **kwargs)
699778
def wait(self, timeout=-1):
        
        if self._process is None:
            raise RuntimeError('no child process')
        if timeout == -1:
            timeout = self._timeout
        if not self._child_exited.wait(timeout):
            raise Timeout('timeout waiting for child to exit')
        return self.returncode
669689
def main(args=None):
    
    streamsx._streams._version._mismatch_check('streamsx.topology.context')
    try:
        sr = run_cmd(args)
        sr['return_code'] = 0
    except:
        sr = {'return_code':1, 'error': sys.exc_info()}
    return sr
152008
def wait(self):
        
        if not self._process_completed:
            self._process_completed = True

            exit_code = self.process.wait()
            if self.process.timed_out:
                # if we timed out, our exit code represents a signal, which is
                # negative, so let's make it positive to store in our
                # TimeoutException
                raise TimeoutException(-exit_code)

            else:
                self.handle_command_exit_code(exit_code)
        
                # if an iterable command is using an instance of OProc for its stdin,
                # wait on it.  the process is probably set to "piped", which means it
                # won't be waited on, which means exceptions won't propagate up to the
                # main thread.  this allows them to bubble up
                if self.process._stdin_process:
                    self.process._stdin_process.command.wait()

        self.log.info("process completed")
        return self
618883
def main(self, argv=None, exit=True):
        
        return CommandRecipe(self).main(argv, exit)
19095
def _execute(params, cwd):
    

    proc = subprocess.Popen(
        params,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        cwd=cwd
    )
    stdout, stderr = proc.communicate()
    code = proc.wait()
    if code != 0:
        e = OSError('subprocess exit code for %r was %d: %s' % (params, code, stderr))
        e.stdout = stdout
        e.stderr = stderr
        raise e
    return (stdout, stderr)
105075
def wait(self):
        """"""
        self._returncode = self.process.wait()
        try:
            self.process.stderr.close()
        except:
            pass
        self.set_status(self.S_DONE, "status set to Done")

        return self._returncode
57819
def execute(self):
        
        # Ensure that we have commands registered
        if not self.commands or self._parser is None:
            raise NotImplementedError(
                "No commands registered with this program!"
            )

        # Handle input from the command line
        args = self.parser.parse_args()                # Parse the arguments

        try:

            handle_default_args(args)                  # Handle the default args

            if not hasattr(args, 'func'):              # Handle no subcommands
                self.parser.print_help()
                self.exit(0)

            msg = args.func(args)                      # Call the default function
            msg = "{}\n".format(msg) if msg else ''    # Format the message
            self.exit(0, msg)                          # Exit cleanly with message

        except Exception as e:
            if hasattr(args, 'traceback') and args.traceback:
                traceback.print_exc()

            msg = color.format(str(e), color.RED)
            self.exit(1, msg)
1167683
def _execute(self, code):
        
        self.globals['example'] = self.example
        eval(code, self.globals)
365210
def run(self):
        ''''''
        with spawn_output_reader() as (stdout_capture, stdout_thread):
            with spawn_output_reader() as (stderr_capture, stderr_thread):
                context = starter_iocontext(stdout_capture, stderr_capture)
                status = self._exec(context)
        stdout_bytes = stdout_thread.join()
        stderr_bytes = stderr_thread.join()
        result = Result(status.code, stdout_bytes, stderr_bytes)
        if is_checked_error(status):
            raise StatusError(result, self)
        return result