Get a process runner and execute the provided +executable+,
 with the provided +options+.

 +executable+ String path to the external executable file.

 +options+ String commandline options to send to the +executable+.
766312
def get_and_execute_process_runner tool, options=nil
      runner = get_process_runner
      runner.execute_open4 clean_path(tool), options
      runner
    end
319889
def main():
    
    parser = argparse.ArgumentParser()
    parser.add_argument('--config_file', dest='config_file', help='Config file to be used in the' +
                        'run.', type=str, required=True, default=None)
    Job.Runner.addToilOptions(parser)
    params = parser.parse_args()
    START = Job.wrapJobFn(parse_config_file, params.config_file).encapsulate()
    Job.Runner.startToil(START, params)
    return None
104727
def _run(*args, **kwargs):
    
    verbose = kwargs.pop("verbose", False)
    if verbose:
        click.secho(" ".join([repr(i) for i in args]), bg='blue', fg='white')

    executable = args[0]
    if not os.path.isfile(executable):
        raise RuntimeError("First argument %r is not a existing file!" % executable)
    if not os.access(executable, os.X_OK):
        raise RuntimeError("First argument %r exist, but is not executeable!" % executable)

    return subprocess.Popen(args, **kwargs)
374055
def run():
	
	parser = argparse.ArgumentParser()
	parser.add_argument(
		'--deps-def',
		default=data_lines_from_file("system deps.txt")
		+ data_lines_from_file("build deps.txt"),
		help="A file specifying the dependencies (one per line)",
		type=data_lines_from_file, dest="spec_deps")
	parser.add_argument(
		'--dep', action="append", default=[],
		help="A specific dependency (multiple allowed)", dest="deps")
	parser.add_argument(
		'command', type=shlex.split,
		default=shlex.split("python2.7 setup.py test"),
		help="Command to invoke in the context of the dependencies")
	parser.add_argument(
		'--do-not-remove', default=False, action="store_true",
		help="Keep any installed packages")
	parser.add_argument(
		'--aggressively-remove', default=False,
		action="store_true",
		help="When removing packages, also remove those automatically installed"
		" as dependencies")
	parser.add_argument(
		'-l', '--log-level', default=logging.INFO,
		type=log_level, help="Set log level (DEBUG, INFO, WARNING, ERROR)")
	args = parser.parse_args()
	logging.basicConfig(level=args.log_level)
	context = dependency_context(
		args.spec_deps + args.deps,
		aggressively_remove=args.aggressively_remove)
	with context as to_remove:
		if args.do_not_remove:
			del to_remove[:]
		raise SystemExit(subprocess.Popen(args.command).wait())
190629
def do(cmdline, runas=None, env=None):
    '''
    
    '''
    if not cmdline:
        # This is a positional argument so this should never happen, but this
        # will handle cases where someone explicitly passes a false value for
        # cmdline.
        raise SaltInvocationError('Command must be specified')

    path = _rbenv_path(runas)
    if not env:
        env = {}

    # NOTE: Env vars (and their values) need to be str type on both Python 2
    # and 3. The code below first normalizes all path components to unicode to
    # stitch them together, and then converts the result back to a str type.
    env[str('PATH')] = salt.utils.stringutils.to_str(   # future lint: disable=blacklisted-function
        os.pathsep.join((
            salt.utils.path.join(path, 'shims'),
            salt.utils.stringutils.to_unicode(os.environ['PATH'])
        ))
    )

    try:
        cmdline = salt.utils.args.shlex_split(cmdline)
    except AttributeError:
        cmdauth = salt.utils.args.shlex_split(six.text_type(cmdline))

    result = __salt__['cmd.run_all'](
        cmdline,
        runas=runas,
        env=env,
        python_shell=False
    )

    if result['retcode'] == 0:
        rehash(runas=runas)
        return result['stdout']
    else:
        return False
249012
public int runCommandLine() throws IOException, InterruptedException
    {
        logRunnerConfiguration();
        
        ProcessBuilder processBuilder = new ProcessBuilder( getCommandLineArguments() );
        processBuilder.directory( workingDirectory );
        processBuilder.environment().putAll( environmentVars );
        Process commandLineProc = processBuilder.start();

        final StreamPumper stdoutPumper = new StreamPumper( commandLineProc.getInputStream(), outputConsumer );
        final StreamPumper stderrPumper = new StreamPumper( commandLineProc.getErrorStream(), errorConsumer );
        stdoutPumper.start();
        stderrPumper.start();
        
        if ( standardInputString != null )
        {
            OutputStream outputStream = commandLineProc.getOutputStream();
            outputStream.write( standardInputString.getBytes() );
            outputStream.close();
        }

        int exitCode = commandLineProc.waitFor();
        stdoutPumper.waitUntilDone();
        stderrPumper.waitUntilDone();
        
        if ( exitCode == 0 )
        {
            LOGGER.fine( processName + " returned zero exit code"  );
        }
        else 
        { 
            LOGGER.severe( processName + " returned non-zero exit code (" + exitCode + ")" );
        }
        
        return exitCode; 
    }
972752
def _get_runner(classpath, main, jvm_options, args, executor,
               cwd, distribution,
               create_synthetic_jar, synthetic_jar_dir):
  """"""

  executor = executor or SubprocessExecutor(distribution)

  safe_cp = classpath
  if create_synthetic_jar:
    safe_cp = safe_classpath(classpath, synthetic_jar_dir)
    logger.debug('Bundling classpath {} into {}'.format(':'.join(classpath), safe_cp))

  return executor.runner(safe_cp, main, args=args, jvm_options=jvm_options, cwd=cwd)
377687
def do_shell(self, arg):
        
        if self.cmdprefix:
            raise CmdError("prefix not allowed")

        # Try to use the environment to locate cmd.exe.
        # If not found, it's usually OK to just use the filename,
        # since cmd.exe is one of those "magic" programs that
        # can be automatically found by CreateProcess.
        shell = os.getenv('ComSpec', 'cmd.exe')

        # When given a command, run it and return.
        # When no command is given, spawn a shell.
        if arg:
            arg = '%s /c %s' % (shell, arg)
        else:
            arg = shell
        process = self.debug.system.start_process(arg, bConsole = True)
        process.wait()
1151044
def runAutomationCommands(self, projectFile, commands, capture=False):
		'''
		
		'''
		
		# IMPORTANT IMPLEMENTATION NOTE:
		# We need to format the command as a string and execute it using a shell in order to
		# ensure the "-ExecCmds" argument will be parsed correctly under Windows. This is because
		# the WinMain() function uses GetCommandLineW() to retrieve the raw command-line string,
		# rather than using an argv-style structure. The string is then passed to FParse::Value(),
		# which checks for the presence of a quote character after the equals sign to determine if
		# whitespace should be stripped or preserved. Without the quote character, the spaces in the
		# argument payload will be stripped out, corrupting our list of automation commands and
		# preventing them from executing correctly.
		
		command = '{} {}'.format(Utility.escapePathForShell(self.getEditorBinary(True)), Utility.escapePathForShell(projectFile))
		command += ' -game -buildmachine -stdout -fullstdoutlogoutput -forcelogflush -unattended -nopause -nullrhi -nosplash'
		command += ' -ExecCmds="automation {};quit"'.format(';'.join(commands))
		
		if capture == True:
			return Utility.capture(command, shell=True)
		else:
			Utility.run(command, shell=True)
1067777
def _make_executable(path):
    """"""
    os.chmod(path, os.stat(path).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
714319
def run(app, argv=sys.argv, extra_args=None):
    
    if app not in argv[:2]:
        # app is automatically added if not present
        argv.insert(1, app)
    if len(argv) < 3 and 'test' not in argv[:2]:
        # test argument is given if not argument is passed
        argv.insert(2, 'test')
    if extra_args:
        argv.extend(extra_args)
    return runner(argv)
844948
def run(args: List[str],
        get_output: bool = False,
        encoding: str = sys.getdefaultencoding()) -> Tuple[str, str]:
    
    printable = " ".join(shlex.quote(x) for x in args).replace("\n", r"\n")
    log.debug("Running external command: {}", printable)
    if get_output:
        p = subprocess.run(args, stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE, check=True)
        stdout, stderr = p.stdout.decode(encoding), p.stderr.decode(encoding)
    else:
        subprocess.check_call(args)
        stdout, stderr = "", ""
    return stdout, stderr
464046
def run_file_or_script (script=None, file_name='script_from_command_line',
                        argv=None, params=None, **kwargs):
    """"""
    runner= Ayrton (**kwargs)

    if params is None:
        params= ExecParams ()

    if script is None:
        v= runner.run_file (file_name, argv, params)
    else:
        if not isinstance(script, bytes):
            # the problem here it's that the parser expects the source as bytes
            # so we must encode the source before passing it
            script = script.encode()
        v= runner.run_script (script, file_name, argv, params)

    return v
860768
function exec(opts, cmd, extra) {
    extra = extra || {};
    var silent = (extra.silent !== false); // Silent, unless explicitly passed `false`
    if ( opts.noWrite && extra.always !== true) {
      grunt.log.writeln('DRY-RUN: would exec: ' + cmd);
    } else {
      grunt.verbose.writeln('Running: ' + cmd);
      var result = shell.exec(cmd, {silent: silent});

      // grunt.verbose.writeln('exec(' + cmd + ') returning code ' + result.code +
      //   ', result: ' + result.stdout);
      if (extra.checkResultCode !== false && result.code !== 0) {
        grunt.fail.warn('exec(' + cmd + ') failed with code ' + result.code +
          ':\n' + result.stdout);
      }else{
        return result;
      }
    }
  }
112620
def execute_command(self, command):
        

        self.runner.info_log("Executing command: %s" % command)

        process = Popen(
                command,
                stdout=open(os.devnull, 'w'),
                stderr=open('runner.log', 'a'),
        )

        return process
1201988
public function executeCommand(array $arguments, $processBuilderCallback = null)
    {
        $processBuilder = clone $this->processBuilder;
        $processBuilder->setArguments($arguments);

        if (is_callable($processBuilderCallback)) {
            $processBuilderCallback($processBuilder);
        }

        $process = $processBuilder->getProcess();
        $process->run();

        if (!$process->isSuccessful()) {
            if (127 === $process->getExitCode()) {
                throw new ExecutableNotFoundException($process);
            }

            throw new ProcessFailedException($process);
        }

        return $process;
    }
585114
def execute(client, output_file, output_paths=None):
    """"""
    output_paths = output_paths or set()

    import cwltool.factory
    from cwltool import workflow
    from cwltool.context import LoadingContext, RuntimeContext
    from cwltool.utils import visit_class

    def construct_tool_object(toolpath_object, *args, **kwargs):
        """Fix missing locations."""
        protocol = 'file://'

        def addLocation(d):
            if 'location' not in d and 'path' in d:
                d['location'] = protocol + d['path']

        visit_class(toolpath_object, ('File', 'Directory'), addLocation)
        return workflow.default_make_tool(toolpath_object, *args, **kwargs)

    argv = sys.argv
    sys.argv = ['cwltool']

    # Keep all environment variables.
    runtime_context = RuntimeContext(
        kwargs={
            'rm_tmpdir': False,
            'move_outputs': 'leave',
            'preserve_entire_environment': True,
        }
    )
    loading_context = LoadingContext(
        kwargs={
            'construct_tool_object': construct_tool_object,
        }
    )

    factory = cwltool.factory.Factory(
        loading_context=loading_context,
        runtime_context=runtime_context,
    )
    process = factory.make(os.path.relpath(str(output_file)))
    outputs = process()

    sys.argv = argv

    # Move outputs to correct location in the repository.
    output_dirs = process.factory.executor.output_dirs

    def remove_prefix(location, prefix='file://'):
        if location.startswith(prefix):
            return location[len(prefix):]
        return location

    locations = {
        remove_prefix(output['location'])
        for output in outputs.values()
    }

    with progressbar(
        locations,
        label='Moving outputs',
    ) as bar:
        for location in bar:
            for output_dir in output_dirs:
                if location.startswith(output_dir):
                    output_path = location[len(output_dir):].lstrip(
                        os.path.sep
                    )
                    destination = client.path / output_path
                    if destination.is_dir():
                        shutil.rmtree(str(destination))
                        destination = destination.parent
                    shutil.move(location, str(destination))
                    continue

    unchanged_paths = client.remove_unmodified(output_paths)
    if unchanged_paths:
        click.echo(
            'Unchanged files:\n\n\t{0}'.format(
                '\n\t'.join(
                    click.style(path, fg='yellow') for path in unchanged_paths
                )
            )
        )