Execute asynchronously using exec
@param string $executable Path to executable file
@param array [optional] $arguments Executable arguments
@param string [optional] $output_stream
@uses exec
@todo use sprintf, make it more readable
514845
public static function async($executable, $arguments = [], $output_stream = '/dev/null')
    {
        exec(
            $executable
            . ($arguments ? ' ' . join(' ', $arguments) : '')
            . '>'
            . $output_stream
            . ' 2>&1 &'
        );
    }
972016
public function execute($path, array $args = [], array $envs = [])
    {
        if (false === @pcntl_exec($path, $args, $envs)) {
            throw new RuntimeException('Error when executing command');
        }
    }
503361
function execute(command, callback){
  exec(command, function(error, stdout, stderr){ callback(error, stdout); });
}
840413
protected function execute( InputInterface $input, OutputInterface $output ) {
		$this->output = $output;
		$this->input = $input;
		$path = $this->setup();
		if ( is_int( $path ) ) {
			return $path;
		}
		$err = $this->loadConfig( $path );
		if ( is_int( $err ) ) {
			return $err;
		}

		$output->writeln( "Processing $path..." );
		$bad = $this->checkPath( $path );
		$output->write( "\n" );
		if ( $bad ) {
			foreach ( $bad as $file ) {
				$output->writeln( "Error: {$file->getPathname()} should not be executable" );
			}
			return 1;
		} else {
			$output->writeln( 'All good!' );
			return 0;
		}
	}
516745
public static void executeHelp(String[] args, PrintStream stream) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        if(subCmd.equals("fetch-entries")) {
            SubCommandStreamFetchEntries.printHelp(stream);
        } else if(subCmd.equals("fetch-keys")) {
            SubCommandStreamFetchKeys.printHelp(stream);
        } else if(subCmd.equals("mirror")) {
            SubCommandStreamMirror.printHelp(stream);
        } else if(subCmd.equals("update-entries")) {
            SubCommandStreamUpdateEntries.printHelp(stream);
        } else {
            printHelp(stream);
        }
    }
321447
public function exec($command)
    {
        // run command
        $exit = -1;
        $logfile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tika-error.log';
        $descriptors = [['pipe', 'r'], ['pipe', 'w'], ['file', $logfile, 'a']];
        $process = proc_open($command, $descriptors, $pipes);
        $callback = $this->callback;

        // get output if command runs ok
        if(is_resource($process))
        {
            fclose($pipes[0]);
            $this->response = '';
            while($chunk = stream_get_line($pipes[1], $this->chunkSize))
            {
                if(!is_null($callback))
                {
                    $callback($chunk);
                }

                $this->response .= $chunk;
            }
            fclose($pipes[1]);
            $exit = proc_close($process);
        }

        // exception if exit value is not zero
        if($exit > 0)
        {
            throw new Exception("Unexpected exit value ($exit) for command $command");
        }

        return trim($this->response);
    }
1061433
private function executeCommand($inputFile, $outputFile)
    {
        // Prevent over-writing existing file.
        if ($inputFile == $outputFile) {
            throw new BuildException('Input file and output file are the same!');
        }

        $output = [];
        $return = null;

        $fullCommand = $this->executable;

        if (strlen($this->flags) > 0) {
            $fullCommand .= " {$this->flags}";
        }

        $fullCommand .= " {$inputFile} {$outputFile}";

        exec($fullCommand, $output, $return);

        return [$return, $output];
    }
526817
def execute_executable(nova_args, env_vars):
    
    process = subprocess.Popen(nova_args,
                               stdout=sys.stdout,
                               stderr=subprocess.PIPE,
                               env=env_vars)
    process.wait()
    return process
365445
async def exec_loop(stdout, stderr, kernel, mode, code, *, opts=None,
                    vprint_done=print_done, is_multi=False):
    '''
    
    '''
    async with kernel.stream_execute(code, mode=mode, opts=opts) as stream:
        async for result in stream:
            if result.type == aiohttp.WSMsgType.TEXT:
                result = json.loads(result.data)
            else:
                # future extension
                continue
            for rec in result.get('console', []):
                if rec[0] == 'stdout':
                    print(rec[1], end='', file=stdout)
                elif rec[0] == 'stderr':
                    print(rec[1], end='', file=stderr)
                else:
                    print('----- output record (type: {0}) -----'.format(rec[0]),
                          file=stdout)
                    print(rec[1], file=stdout)
                    print('----- end of record -----', file=stdout)
            stdout.flush()
            files = result.get('files', [])
            if files:
                print('--- generated files ---', file=stdout)
                for item in files:
                    print('{0}: {1}'.format(item['name'], item['url']), file=stdout)
                print('--- end of generated files ---', file=stdout)
            if result['status'] == 'clean-finished':
                exitCode = result.get('exitCode')
                msg = 'Clean finished. (exit code = {0})'.format(exitCode)
                if is_multi:
                    print(msg, file=stderr)
                vprint_done(msg)
            elif result['status'] == 'build-finished':
                exitCode = result.get('exitCode')
                msg = 'Build finished. (exit code = {0})'.format(exitCode)
                if is_multi:
                    print(msg, file=stderr)
                vprint_done(msg)
            elif result['status'] == 'finished':
                exitCode = result.get('exitCode')
                msg = 'Execution finished. (exit code = {0})'.format(exitCode)
                if is_multi:
                    print(msg, file=stderr)
                vprint_done(msg)
                break
            elif result['status'] == 'waiting-input':
                if result['options'].get('is_password', False):
                    code = getpass.getpass()
                else:
                    code = input()
                await stream.send_str(code)
            elif result['status'] == 'continued':
                pass
743014
static DefaultExecuteResultHandler execute(CommandLine cmdLine, OutputStream out, OutputStream err)
            throws ExecuteException, IOException {
        return execute(cmdLine, Collections.<String, String> emptyMap(), out, err);
    }
1327089
function execute(argv, bin, args, req) {
  var config = this.configure();
  var errors = this.errors, scope = this, e;
  var dir = config.bin || dirname(argv[1]);
  var local = path.join(dir, bin);
  var exists = fs.existsSync(local);
  var data = {bin: bin, dir: dir, local: local, args: args};
  if(!exists) {
    e = new ExecError(errors.EEXEC_NOENT.message, [bin], errors.EEXEC_NOENT.code);
    e.data = data;
    throw e;
  }
  var stat = fs.statSync(local);
  var ps = spawn(local, args, {stdio: [0, 1, 'pipe']});
  req.process = ps;
  this.emit('exec', ps, local, args, req);
  ps.on('error', function(err){
    error(scope, err, [bin]);
  });
  // suppress the execvp() error so we can cleanly
  // present our own error message
  ps.stderr.on('data', function(data) {
    if(!/^execvp\(\)/.test(data.toString())) {
      process.stderr.write(data);
    }
  })
  ps.on('close', function (code, signal) {
    // NOTE: workaround for https://github.com/joyent/node/issues/3222
    // NOTE: assume child process exited gracefully on SIGINT
    if(signal == 'SIGINT') {
      return process.exit(0);
    }
    // TODO: remove this event?
    scope.emit('close', code, signal);
    if(config.exit) process.exit(code);
  });
  return ps;
}
530107
static function executeCommand($command)
    {
        exec($command, $output, $resultCode);

        if ($resultCode > 0) {
            $output = implode("\n", $output);
            throw new Exception("Failed to execute command: '$command' with output: '$output' ");
        }
    }
515278
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $interval = NumberUtils::bound($input->getOption('interval'), 1, 60);
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');
        $streamId = StreamId::fromString($input->getArgument('stream-id'));

        $eventStore = $this->getPbjx()->getEventStore();
        $since = Microtime::create();

        while (true) {
            $event = null;
            $slice = $eventStore->getStreamSlice($streamId, $since, 25, true, false, $context);

            foreach ($slice as $event) {
                try {
                    echo json_encode($event) . PHP_EOL;
                } catch (\Throwable $e) {
                    $errOutput->writeln($e->getMessage());
                }
            }

            if ($event instanceof Event) {
                $since = $event->get('occurred_at');
            }

            sleep($interval);
        }
    }
937473
private static function exec(array $args)
    {
        $cmd = implode(' ', array_map('escapeshellarg', $args)) . ' 2>/dev/null';
        $process = proc_open($cmd, [1 => ['pipe', 'w']], $pipes);
        $output = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        if (proc_close($process) !== 0) {
            return false;
        }

        return $output;
    }
870703
function exec(cmd, args, options) {
    // If true user wants stdout to output value
    // instead of using inherit outputting
    // to process.stdout stream.
    if (options === true)
        options = { stdio: 'pipe' };
    options = chek_1.extend({}, spawnDefaults, options);
    if (chek_1.isString(args))
        args = argv_1.splitArgs(args);
    // Ensure command and arguments.
    if (!cmd)
        logger_1.log.error('Cannot execute process with command of undefined.');
    args = args.map(function (s) {
        if (/\s/g.test(s))
            return '"' + s + '"';
        return s;
    });
    // Spawn child.
    var child = child_process_1.spawnSync(cmd, args, options);
    if (child.stdout)
        return child.stdout.toString();
}
1257311
public function executeCommand(&$output)
	{
		$descriptorspec = array(
			0 => array("pipe", "r"), // stdin is a pipe that the child will read from
			1 => array("pipe", "w"), // stdout is a pipe that the child will write to
			2 => array("pipe", "w") // stderr is a pipe that the child will write to
		);

		$process = proc_open($this->cmd . ' ' . $this->getParams() . ' ' . $this->getInputSource() . ' ' . $this->getPDFPath(), $descriptorspec, $pipes);

		$output = stream_get_contents($pipes[1]) . stream_get_contents($pipes[2]);

		fclose($pipes[0]);
		fclose($pipes[1]);
		fclose($pipes[2]);

		return proc_close($process);
	}
301137
public function runCommand(Command $command, array $parameters = [], OutputInterface $output = null)
    {
        $parameters['command'] = $command->getName();
        $input = new ArrayInput($parameters);

        if ($output === null) {
            $output = new NullOutput();
        }

        $command->setApplication(new SymfonyConsoleApplication());

        return $command->run($input, $output);
    }