Run the command.

@return ProcessRun
969696
public function run() {
		$cwd = $this->cwd;

		$descriptors = array(
			0 => STDIN,
			1 => array( 'pipe', 'w' ),
			2 => array( 'pipe', 'w' ),
		);

		$proc = proc_open( $this->command, $descriptors, $pipes, $cwd, $this->env );

		$stdout = stream_get_contents( $pipes[1] );
		fclose( $pipes[1] );

		$stderr = stream_get_contents( $pipes[2] );
		fclose( $pipes[2] );

		return new ProcessRun( array(
			'stdout' => $stdout,
			'stderr' => $stderr,
			'return_code' => proc_close( $proc ),
			'command' => $this->command,
			'cwd' => $cwd,
			'env' => $this->env
		) );
	}
313010
public function run()
    {
        $result = $this->getCommand()->run();

        if ($result->getExitCode() != 0) {
            throw new \RuntimeException(sprintf(
                'Command failed. Exit code %d, output %s',
                $result->getExitCode(),
                $result->getStdErr()));
        }

        return $this->parse($result->getStdOut());
    }
190348
public function run()
    {
        // If the truthTest failed, don't run
        if ($this->truthTest !== true) {
            return false;
        }

        // If overlapping, don't run
        if ($this->isOverlapping()) {
            return false;
        }

        // Write lock file if necessary
        $this->createLockFile();

        // Call before if required
        if (is_callable($this->before)) {
            call_user_func($this->before);
        }

        // If command is callable...
        if (is_callable($this->command)) {
            $this->output = $this->exec();
        } else {
            $args = \is_string($this->args) ? $this->args : implode(' ', $this->args);
            $command = $this->command . ' ' . $args;
            $process = new Process($command);

            $this->process = $process;

            if ($this->runInBackground()) {
                $process->start();
            } else {
                $process->run();
                $this->finalize();
            }
        }

        return true;
    }
776095
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) {
    return $this->doRunCommand($command, $input, $output);
  }
328176
public function run()
    {
        try {
            return $this
                ->preRun()
                ->check();
        } catch (Exception $e) {
            return $this
                ->setMessage($e->getMessage())
                ->setCode($e->getCode());
        }
    }
973456
public function run()
    {
        //Bogus variable set. The original value is never used, but IDEs complain
        $result = new Result();
        $resultArray = array();
        $max = count($this->commands);

        for ($i = 0; $i < $max; ++$i) {
            $cmd = $this->commands[$i];

            if ($i === 0) {
                $resultArray[] = $result = $cmd->run();
                continue;
            }

            if (($cmd->_runMode === RUN_IF_PREVIOUS_SUCCEEDS && $result->getExitCode() !== 0) ||
                ($cmd->_runMode === RUN_IF_PREVIOUS_FAILS && $result->getExitCode() === 0)
            ) {
                continue;
            }

            if ($cmd->_pipe) {
                $stdOut = trim($result->getStdOut());

                $isXArg = false;
                foreach ($cmd as $argIdx => $arg) {
                    if ($arg instanceof Argument) {
                        if (stripos($arg->getKey(true), PIPE_PH) !== false) {
                            $key = str_replace(PIPE_PH, $stdOut, $arg->getKey(true));
                            $arg->setKey($key);
                        }

                        $values = $arg->getValues();
                        foreach ($values as $index => $val) {
                            if (stripos($val, PIPE_PH) !== false) {
                                $val = str_replace(PIPE_PH, $stdOut, $val);
                                $arg->replaceValue($index, $val);
                                $isXArg = true;
                            }
                        }
                    }
                }
                if (!$isXArg) {
                    $cmd->setStdIn($stdOut);
                }
            }

            $resultArray[] = $result = $cmd->run();
        }

        return $resultArray;
    }
1075866
public function run()
    {
        if ($this->initialized) {
            $this->console(sprintf("Start running '%s' method of script '%s'.", $this->opts->action, get_class($this)));
            $this->{$this->action}();
            $this->console(sprintf("End of running '%s' cli script.", get_class($this)), true);
        }

        return $this;
    }
194022
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        $matches = [];
        if (preg_match_all('/(?:(?:\A|[^\d])0x[a-f\d]{3,}[a-f\d]*)+/im', $this->value, $matches)) {
            foreach ($matches[0] as $match) {
                $converted = '';
                foreach (str_split($match, 2) as $hexIndex) {
                    if (preg_match('/[a-f\d]{2,3}/i', $hexIndex)) {
                        $converted .= chr(hexdec($hexIndex));
                    }
                }
                $this->value = str_replace($match, $converted, $this->value);
            }
        }
        // take care of hex encoded ctrl chars
        $this->value = preg_replace('/0x\d+/m', ' 1 ', $this->value);

        return $this->value;
    }
1186846
public function run()
    {
        $this->setUserAndGroup();

        $out = $this->out;
        $err = $this->err;
        $process = new \Symfony\Component\Process\Process($this->cmd, null, null, null, null);
        $process->run(function ($type, $buffer) use ($out, $err) {
            if ($type == \Symfony\Component\Process\Process::ERR) {
                $err->error($buffer);
            } else {
                $out->info($buffer);
            }
        });
    }
175821
public function run() {
		$start_time = microtime( true );

		$proc = Utils\proc_open_compat( $this->command, self::$descriptors, $pipes, $this->cwd, $this->env );

		$stdout = stream_get_contents( $pipes[1] );
		fclose( $pipes[1] );

		$stderr = stream_get_contents( $pipes[2] );
		fclose( $pipes[2] );

		$return_code = proc_close( $proc );

		$run_time = microtime( true ) - $start_time;

		if ( self::$log_run_times ) {
			if ( ! isset( self::$run_times[ $this->command ] ) ) {
				self::$run_times[ $this->command ] = array( 0, 0 );
			}
			self::$run_times[ $this->command ][0] += $run_time;
			self::$run_times[ $this->command ][1]++;
		}

		return new ProcessRun(
			array(
				'stdout'      => $stdout,
				'stderr'      => $stderr,
				'return_code' => $return_code,
				'command'     => $this->command,
				'cwd'         => $this->cwd,
				'env'         => $this->env,
				'run_time'    => $run_time,
			)
		);
	}
1146246
public function run()
    {
        $output = Colors::RED.Colors::BG_BLACK."
  _______                  ____  __   ______
 /__  __/_____ ___  ____  / __ \/ /  / / __ \
   / /  / ___/ __ \/ __ \/ /_/ / /__/ / /_/ /
 _/ /__/ /  / /_/ / / / / .___/ ___  / .___/
/_____/_/   \____/_/ /_/_/   /_/  /_/_/
".
        $this->getWelInfo().
        Colors::BG_BLACK.Colors::WHITE;
        return $output;
    }
881481
public function run()
    {
        $output = PHP_EOL.$this->key().Colors::BG_BLACK.Colors::WHITE;
        return $output;
    }
237434
public function run()
    {
        if ($this->app->getName()) {
            $this->output->writeln($this->app->getName());
            $this->output->newline();
        }

        $commandName = $this->parameter->getArgument('command_name');

        if ($this->parameter->getCommandName() === $this->name && $commandName) {
            $this->showCommandHelp($this->parameter->getArgument('command_name'));
        } else {
            $this->showGeneralHelp();
        }

        return $this;
    }
636780
public static function run()
    {
        if ($_SERVER['argc'] < 2) {
            self::helpAction();
            exit();
        }
        $method = $_SERVER['argv'][1] . 'Action';
        if (method_exists(static::getCurrentClass(), $method)) {
            $params = $_SERVER['argv'];
            array_shift($params);
            array_shift($params);
            call_user_func_array(array(static::getCurrentClass(), $method), $params);
        } else {
            self::displayError("command unknown", true);
        }
    }
200962
public function run()
	{
		// streams
		$read = [$this->_input];

		$write  = null;
		$except = null;

		// stream ends?
		$end_of_stream = false;

		$waitForMinComputationTime = defined('PROKKIBOT_MIN_COMPUTATION_TIME') && !empty(PROKKIBOT_MIN_COMPUTATION_TIME);

		do
		{

			$changed_streams = stream_select($read, $write, $except, PROKKIBOT_MAX_SERVER_TIMEOUT);

			if( $waitForMinComputationTime )
			{
				$time_start = get_microtime_float();
			}
			
			if( false === $changed_streams )
			{
				die();
			}

			foreach( $read as $_handle )
			{

				$string = trim(fgets($_handle));

				if( empty($string) )
				{
					$end_of_stream = true;
					continue;
				}

				Debugger::Log(sprintf("received: %s\n", $string));

				$end_of_stream = feof($_handle);

				try
				{

					$command = $this->_bot->getParser()->run($string);

//					Debugger::Log(get_class($command) . "\n");

					$command->apply($this->_bot);

//					Debugger::Log("applied\n");

//					Debugger::Log(sprintf("Round: %d, Remaining: %d, Last: %d\n",
//						$this->_environment->getCurrentRoundNo(),
//						$this->_environment->getRemainingRounds(),
//						$this->_environment->isLastRound()
//					));

					if( $command->isComputable() )
					{

						/** @var Computable $command */
						$send = $command->compute($this->_bot);

						if( $waitForMinComputationTime )
						{
							self::_WaitForMinCompuitationTime($time_start);
						}

						fwrite($this->_output, $send . "\n");

						Debugger::Log(sprintf("send: %s\n", $send));
					}

				}
				catch( \Exception $exception )
				{
					Debugger::Log(sprintf("Exception:%s\n\n%s", $exception->getMessage(), $exception->getTraceAsString()));

					$send = "Aborting due an error :-(";

					fwrite($this->_output, $send . "\n");

					Debugger::Log(sprintf("send: %s\n", $send));

					$end_of_stream = true;
				}

			}
		}
		while( !$end_of_stream && !empty($changed_streams) );

		Debugger::Log("MEM: " . size_to_readable_string(memory_get_usage(true)) . "\n");

		Debugger::Log("END!\n");

		fclose($this->_input);
	}
159370
protected function run()
    {
        if (stripos(PHP_OS, 'win') === 0) {
           throw new \Exception('The WorkerManagerRunner only works on linux');
        }

        /** @var WorkerProcessManager $workerManager */
        $workerManager = $this->getServiceLocator()->get(WorkerProcessManager::SERVICE_ID);
        $workerManager->setLimitOfCpu($this->getOption('limitOfCpu'));
        $workerManager->setLimitOfMemory($this->getOption('limitOfMemory'));

        /** @var TaskSerializerService $taskSerializer */
        $taskSerializer = $this->getServiceLocator()->get(TaskSerializerService::SERVICE_ID);
        $queueService   = $this->getQueueService();
        $loop           = Factory::create();

        $interval = $this->getOption('interval');
        $loop->addPeriodicTimer($interval, function () use ($loop, $queueService, $taskSerializer, $workerManager) {
            if ($workerManager->canRun()) {
                $task = $queueService->dequeue();
                if ($task !== null) {
                    $cmd = $workerManager->getCommand();
                    $taskJson = base64_encode($taskSerializer->serialize($task));
                    $cmd = 'cd '.ROOT_PATH.' && '.$cmd.' -t '.$taskJson;

                    $process = new \React\ChildProcess\Process($cmd);
                    $process->start($loop);
                    $workerManager->addProcess($process);
                }

                unset($task);
            }
        });

        $loop->run();
    }
369787
public function run()
    {
        return call_user_func(
            array_reduce(
                array_reverse($this->pipes),
                $this->createPipelineCallback(),
                function ($request) {
                    return ($this->callback === null) ? $request : call_user_func($this->callback, $request);
                }
            ),
            $this->request
        );
    }