Runs the shell.
@codeCoverageIgnore
427083
public function run()
    {
        stream_set_blocking(STDIN,0);

        $r = array(STDIN);
        $w = array();
        $e = array();

        $n = @stream_select($r,$w,$e,1);

        if ($n && in_array(STDIN, $r)) {
            $this->readline();
        }

        return true;
    }
1008190
public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        if (null === $input) {
            $input = $this->input;
        }

        if (null === $output) {
            $output = $this->output;
        }

        /* @codeCoverageIgnoreStart */
        if (
            !getenv('DOTFILES_BACKUP_DIR')
            && ('dev' !== getenv('DOTFILES_ENV'))
        ) {
            return $this->find('init')->run($input, $output);
        }
        /* @codeCoverageIgnoreEnd */
        $this->setDefaultCommand('shell');

        return parent::run($input, $output);
    }
320095
public function run()
    {
        $this->setupSignalHandlers();

        $procs = [];
        while (true) {
            $jobs = $this->runner->getJobs();
            foreach ($jobs as $job) {
                if (! array_key_exists($job->identifier(), $procs)) {
                    $procs[$job->identifier()] = [];
                }
                while (count($procs[$job->identifier()]) > $job->numWorkers()) {
                    // Stopping an excessive child.
                    echo 'Stopping an excessive child.' . PHP_EOL;
                    $proc = array_pop($procs[$job->identifier()]);
                    $status = proc_get_status($proc);
                    // Keep sending SIGTERM until the child exits.
                    while ($status['running'] === true) {
                        @proc_terminate($proc);
                        usleep(50000);
                        $status = proc_get_status($proc);
                    }
                    @proc_close($proc);
                }
                for ($i = 0; $i < $job->numWorkers(); $i++) {
                    $needStart = false;
                    if (array_key_exists($i, $procs[$job->identifier()])) {
                        $status = proc_get_status($procs[$job->identifier()][$i]);
                        if ($status['running'] !== true) {
                            $needStart = true;
                        }
                    } else {
                        $needStart = true;
                    }
                    if ($needStart) {
                        echo 'Starting a child.' . PHP_EOL;
                        $procs[$job->identifier()][$i] = proc_open(
                            sprintf('%s %d', $this->command, $job->id()),
                            $this->descriptorSpec,
                            $pipes
                        );
                    }
                }
            }
            usleep(1000000); // Reload the config after 1 second
            pcntl_signal_dispatch();
            if ($this->shutdown) {
                echo 'Shutting down, waiting for the children' . PHP_EOL;
                foreach ($procs as $k => $v) {
                    foreach ($v as $proc) {
                        $status = proc_get_status($proc);
                        // Keep sending SIGTERM until the child exits.
                        while ($status['running'] === true) {
                            @proc_terminate($proc);
                            usleep(50000);
                            $status = proc_get_status($proc);
                        }
                        @proc_close($proc);
                    }
                }
                echo 'BatchDaemon exiting' . PHP_EOL;
                exit;
            }
            // Reload the config
            $this->runner->loadConfig();
        }
    }
191037
public function run()
    {
        $data       = $this->parseRequestUri();
        $controller = $data['controller'];
        $method     = $data['method'];
        $params     = $data['params'];

        $subModule  = $this->subModule;
        if ("" != $subModule) {
            $subModule = "\\" . $subModule;
        }

        $class      = sprintf("%s\\Controller%s\\%sController", $this->appNameSpace, $subModule, $controller);
        if (!(class_exists($class) && method_exists($class, $method))) {
            $this->fileNotFound();
        } else {
            $class  = new $class;
            $pipe = new Pipeline();
            $pipe->through($class->getMiddleWare())->then(function () use ($class, $method, $params) {
                call_user_func_array(array($class, $method), $params);
            });

            //call_user_func_array(array($class, $method), $params);
        }
    }
1157224
public function run()
    {
        if (!$this->proc) {
            $this->out('Couldn\'t execute CGI proccess.');
            $this->finish();
            return;
        }
        if (!$this->proc->eof()) {
            $this->sleep();
        }
    }
339788
public function run()
    {
        gc_collect_cycles();
        gc_disable();

        if ($this->dryRun) {
            $this->verbose = true;
            $this->runScripts = false;
            $this->installationManager->addInstaller(new NoopInstaller);
            $this->mockLocalRepositories($this->repositoryManager);
        }

        // TODO remove this BC feature at some point
        // purge old require-dev packages to avoid conflicts with the new way of handling dev requirements
        $devRepo = new InstalledFilesystemRepository(new JsonFile($this->config->get('vendor-dir').'/composer/installed_dev.json'));
        if ($devRepo->getPackages()) {
            $this->io->writeError('<warning>BC Notice: Removing old dev packages to migrate to the new require-dev handling.</warning>');
            foreach ($devRepo->getPackages() as $package) {
                if ($this->installationManager->isPackageInstalled($devRepo, $package)) {
                    $this->installationManager->uninstall($devRepo, new UninstallOperation($package));
                }
            }
            unlink($this->config->get('vendor-dir').'/composer/installed_dev.json');
        }
        unset($devRepo, $package);
        // end BC

        if ($this->runScripts) {
            // dispatch pre event
            $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
            $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
        }

        $this->downloadManager->setPreferSource($this->preferSource);
        $this->downloadManager->setPreferDist($this->preferDist);

        // clone root package to have one in the installed repo that does not require anything
        // we don't want it to be uninstallable, but its requirements should not conflict
        // with the lock file for example
        $installedRootPackage = clone $this->package;
        $installedRootPackage->setRequires(array());
        $installedRootPackage->setDevRequires(array());

        // create installed repo, this contains all local packages + platform packages (php & extensions)
        $localRepo = $this->repositoryManager->getLocalRepository();
        if (!$this->update && $this->locker->isLocked()) {
            $platformOverrides = $this->locker->getPlatformOverrides();
        } else {
            $platformOverrides = $this->config->get('platform') ?: array();
        }
        $platformRepo = new PlatformRepository(array(), $platformOverrides);
        $repos = array(
            $localRepo,
            new InstalledArrayRepository(array($installedRootPackage)),
            $platformRepo,
        );
        $installedRepo = new CompositeRepository($repos);
        if ($this->additionalInstalledRepository) {
            $installedRepo->addRepository($this->additionalInstalledRepository);
        }

        $aliases = $this->getRootAliases();
        $this->aliasPlatformPackages($platformRepo, $aliases);

        try {
            $this->suggestedPackages = array();
            $res = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $this->devMode);
            if ($res !== 0) {
                return $res;
            }
        } catch (\Exception $e) {
            $this->installationManager->notifyInstalls();

            throw $e;
        }
        $this->installationManager->notifyInstalls();

        // output suggestions if we're in dev mode
        if ($this->devMode) {
            foreach ($this->suggestedPackages as $suggestion) {
                $target = $suggestion['target'];
                foreach ($installedRepo->getPackages() as $package) {
                    if (in_array($target, $package->getNames())) {
                        continue 2;
                    }
                }

                $this->io->writeError($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
            }
        }

        # Find abandoned packages and warn user
        foreach ($localRepo->getPackages() as $package) {
            if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
                continue;
            }

            $replacement = (is_string($package->getReplacementPackage()))
                ? 'Use ' . $package->getReplacementPackage() . ' instead'
                : 'No replacement was suggested';

            $this->io->writeError(
                sprintf(
                    "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
                    $package->getPrettyName(),
                    $replacement
                )
            );
        }

        if (!$this->dryRun) {
            // write lock
            if ($this->update || !$this->locker->isLocked()) {
                $localRepo->reload();

                // if this is not run in dev mode and the root has dev requires, the lock must
                // contain null to prevent dev installs from a non-dev lock
                $devPackages = ($this->devMode || !$this->package->getDevRequires()) ? array() : null;

                // split dev and non-dev requirements by checking what would be removed if we update without the dev requirements
                if ($this->devMode && $this->package->getDevRequires()) {
                    $policy = $this->createPolicy();
                    $pool = $this->createPool(true);
                    $pool->addRepository($installedRepo, $aliases);

                    // creating requirements request
                    $request = $this->createRequest($this->package, $platformRepo);
                    $request->updateAll();
                    foreach ($this->package->getRequires() as $link) {
                        $request->install($link->getTarget(), $link->getConstraint());
                    }

                    $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
                    $solver = new Solver($policy, $pool, $installedRepo);
                    $ops = $solver->solve($request, $this->ignorePlatformReqs);
                    $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
                    foreach ($ops as $op) {
                        if ($op->getJobType() === 'uninstall') {
                            $devPackages[] = $op->getPackage();
                        }
                    }
                }

                $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
                $platformDevReqs = $this->devMode ? $this->extractPlatformRequirements($this->package->getDevRequires()) : array();

                $updatedLock = $this->locker->setLockData(
                    array_diff($localRepo->getCanonicalPackages(), (array) $devPackages),
                    $devPackages,
                    $platformReqs,
                    $platformDevReqs,
                    $aliases,
                    $this->package->getMinimumStability(),
                    $this->package->getStabilityFlags(),
                    $this->preferStable || $this->package->getPreferStable(),
                    $this->preferLowest,
                    $this->config->get('platform') ?: array()
                );
                if ($updatedLock) {
                    $this->io->writeError('<info>Writing lock file</info>');
                }
            }

            if ($this->dumpAutoloader) {
                // write autoloader
                if ($this->optimizeAutoloader) {
                    $this->io->writeError('<info>Generating optimized autoload files</info>');
                } else {
                    $this->io->writeError('<info>Generating autoload files</info>');
                }

                $this->autoloadGenerator->setDevMode($this->devMode);
                $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
            }

            if ($this->runScripts) {
                // dispatch post event
                $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
                $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
            }

            $vendorDir = $this->config->get('vendor-dir');
            if (is_dir($vendorDir)) {
                touch($vendorDir);
            }
        }

        return 0;
    }
1025030
public function run() {
		try {
			$vulnerabilities = $this->checker->check_site( $this->options->ignored_packages );

			do_action( 'soter_site_check_complete', $vulnerabilities );

			$this->options->get_store()->set( 'last_scan_hash', $vulnerabilities->hash() );
		} catch ( \RuntimeException $e ) {
			// Gross?
			$options = _soter_instance( 'options_manager' );
			$use_html = 'html' === $options->email_type;

			wp_mail(
				// @todo Should this go straight to admin email instead?
				$options->email_address,
				'HTTP error while checking ' . get_bloginfo( 'name' ) . ' for vulnerabilities',
				$use_html
					? $this->render_html_error_email( $e )
					: $this->render_text_error_email( $e ),
				$use_html ? [ 'Content-type: text/html' ] : []
			);
		}
	}
1008513
public function run()
    {
        if (!$this->osimage instanceof Osimage) {
            echo $this->imageName;

            return;
        }

        echo $this->osimage->getFullOsName();
        echo '&nbsp;';
        if ($this->osimage->hasSoftPack() && $this->infoCircle) {
            $this->generateInfoCircle();
        }
    }
113720
public function run()
	{
		// Login to the remote server
		$this->printTaskInfo('Logging into remote server - <info>ssh://'.$this->sshUser.'@'.$this->sshHost.'/</info>');
		$ssh = new SFTP($this->sshHost);

		// Do we use password or a key
		if (file_exists($this->sshKey) && empty($this->sshPass))
		{
			$key = new RSA();
			$key->loadKey(file_get_contents($this->sshKey));
			if (!$ssh->login($this->sshUser, $key))
			{
				throw new RuntimeException
				(
					'Failed to login via SSH using Key Based Auth.'
				);
			}
		}
		else
		{
			if (!$ssh->login($this->sshUser, $this->sshPass))
			{
				throw new RuntimeException
				(
					'Failed to login via SSH using Password Based Auth.'
				);
			}
		}

		// Create our dump filename
		$dump_name = $this->remoteDbName.'_'.time();

		// Create our dump on the remote server
		$cmd = 'mysqldump '.
			'-h'.$this->remoteDbHost.
			' -u'.$this->remoteDbUser.
			' '.(empty($this->remoteDbPass) ? '' : '-p'.$this->remoteDbPass).
			' '.$this->remoteDbName.' > /tmp/'.$dump_name.'.sql'
		;
		$this->printTaskInfo('Dumping db on remote server - <info>'.$cmd.'</info>');
		$results = $ssh->exec($cmd);
		if ($ssh->getExitStatus() > 0)
		{
			throw new RuntimeException
			(
				'Failed to create dump on remote server. '.
				$results
			);
		}

		// Compressing dump
		$cmd = 'gzip /tmp/'.$dump_name.'.sql';
		$this->printTaskInfo('Compressing dump on remote server - <info>'.$cmd.'</info>');
		$results = $ssh->exec($cmd);
		if ($ssh->getExitStatus() > 0)
		{
			throw new RuntimeException
			(
				'Failed to compress dump on remote server. '.
				$results
			);
		}

		// Copy it down locally
		$this->printTaskInfo('Transfering dump to local.');
		$temp_dump_name = tempnam(sys_get_temp_dir(), 'dump');
		$temp_dump = $temp_dump_name.'.sql.gz';
		if (!$ssh->get('/tmp/'.$dump_name.'.sql.gz', $temp_dump))
		{
			throw new RuntimeException('Failed to download dump.');
		}

		// Remove the dump from the remote server
		$this->printTaskInfo('Removing dump from remote server - <info>rm /tmp/'.$dump_name.'.sql.gz</info>');
		if (!$ssh->delete('/tmp/'.$dump_name.'.sql.gz'))
		{
			throw new RuntimeException('Failed to delete dump on remote server.');
		}

		// Import the dump locally
		if (
			!$this->taskImportSqlDump($temp_dump)
				->host($this->localDbHost)
				->user($this->localDbUser)
				->pass($this->localDbPass)
				->name($this->localDbName)
			->run()->wasSuccessful()
		){
			throw new RuntimeException('Failed to import dump on local server.');
		}

		$this->printTaskInfo('Deleting dump locally.');
		unlink($temp_dump); unlink($temp_dump_name);

		// If we get to here assume everything worked
		return Result::success($this);
	}
124029
public function run()
    {
        if ($this->stage++ > 0) {
            $this->header('500 Too Busy');
            return;
        }
        if ($this->attrs->raw === '') {
            $this->header('500 Internal Server Error');
            echo 'Payload expected.';
            return;
        }
        if (!json_decode($this->attrs->raw, true)) {
            $this->header('500 Internal Server Error');
            echo 'Broken JSON encoding.';
            return;
        }
        $this->appInstance->publish('c2s:' . $this->sessId, $this->attrs->raw, function ($redis) {
            if (!$this->headers_sent) {
                if ($redis->result === 0) {
                    $this->header('404 Not Found');
                } else {
                    $this->header('204 No Content');
                }
            }
            $this->finish();
        });
        $this->sleep(10);
    }
262856
public function run()
    {
        if (!isset($_SERVER['argv'][1])) {
            $_SERVER['argv'][1] = 'commands';
        }

        $input = $_SERVER['argv'][1];

        // Force `commands` command
        if (in_array(strtolower(trim($input)), ['-h', '--help', 'help'], true)) {
            $input = $_SERVER['argv'][1] = 'commands';
        }

        if (in_array(strtolower(trim($input)), ['--version', '-v', '--info'], true)) {
            $input = $_SERVER['argv'][1] = 'info';
        }

        // Try to dispatch the command
        foreach ($this->_commands as $command) {
            if ($command->hasIdentifier($input)) {
                return $this->dispatch($command);
            }
        }

        // Check for alternatives
        $available = [];
        foreach ($this->_commands as $command) {
            $providedCommands = $command->getCommands();
            foreach ($providedCommands as $alias) {
                $soundex = soundex($alias);
                if (!isset($available[$soundex])) {
                    $available[$soundex] = [];
                }

                $available[$soundex][] = $alias;
            }
        }

        // Show exception with/without alternatives
        $soundex = soundex($input);
        $message = sprintf('%s is not a recognized command.', $input);

        if (isset($available[$soundex])) {
            throw new ScriptException(sprintf('%s Did you mean: %s?', $message, join(' or ', $available[$soundex])));
        }

        throw new ScriptException($message);
    }
467165
public function run()
    {
        parent::run();

        while (\count($this->running) || \count($this->pending)) {
            foreach ($this->running as $key => $test) {
                try {
                    if (!$this->testIsStillRunning($test)) {
                        unset($this->running[$key]);
                        $this->releaseToken($key);
                    }
                } catch (\Exception $e) {
                    if ($this->options->verbose) {
                        echo "An error for $key: {$e->getMessage()}" . PHP_EOL;
                        echo "Command: {$test->getLastCommand()}" . PHP_EOL;
                        echo 'StdErr: ' . $test->getStderr() . PHP_EOL;
                        echo 'StdOut: ' . $test->getStdout() . PHP_EOL;
                    }
                    throw $e;
                }
            }
            $this->fillRunQueue();
            usleep(10000);
        }
        $this->complete();
    }
454884
public function run()
	{
		$this->style->getCharacter()->setIsSuperscript(
			$this->parameter === null || (bool) $this->parameter
		);
		
		return;
	}
186119
public function run(): void
    {
        pcntl_async_signals(true);

        $this->makeSocket();

        [$pid, $master, $workers] = $this->spawn();

        if ($pid) {
            fclose($this->socket);
            $this->workerPids = $workers;
            $this->handleSignals();

            (new Master($workers, $this->unixConnector, $this->exchangeWorkersData))->dispatch();
        } else {
            if ($this->useConnector) {
                fclose($this->unixConnector);
            }

            (new $this->handler($this->socket, $master))->handle();
        }
    }
491253
public function run()
    {
        $port = (int) $this->arg->options('--port', 5000);

        $hostname = $this->arg->options('--host', 'localhost');

        $settings = $this->arg->options('--php-settings', false);

        if (is_bool($settings)) {
            $settings = '';
        } else {
            $settings = '-d '.$settings;
        }

        // resource.
        $writing_stream = fopen("php://stdout", "w");

        $message = sprintf(
            "[%s] Server start at http://%s:%s \033[0;31;7mCTRL-C for shutdown it\033[00m\n",
            date('F d Y H:i:s a'),
            $hostname,
            $port
        );

        fwrite($writing_stream, $message);

        // Close Open stream
        fclose($writing_stream);

        $filename = $this->setting->getServerFilename();
        $public_directory = $this->setting->getPublicDirectory();

        // Launch the dev server.
        shell_exec(
            "php -S $hostname:$port -t {$public_directory} ".$filename." $settings"
        );
    }
542443
public function run()
    {
        $parser = $this->createParser();
        try {
            $result = $parser->parse();
            $file   = $result->args['infile'];
            $format = $result->options['format'];
            $css    = $result->options['css'];

            if ($format == '') {
                $format = $this->detectFormat($file);
            }

            $geshi = new GeSHi(file_get_contents($file), $format);
            if ($css) {
                $geshi->enable_classes();
                echo '<style type="text/css">' . "\n"
                    . $geshi->get_stylesheet(true)
                    . "</style>\n";
            }
            echo $geshi->parse_code() . "\n";
        } catch (Exception $e) {
            $parser->displayError($e->getMessage());
            exit(1);
        }
    }
844416
public static function run()
    {
        \Swoole\Runtime::enableCoroutine();
        self::$debug = new \swoole_atomic(0);
        self::$xdebug = false;
        self::$coverage = false;
        self::$leader = new \swoole_atomic(0);
        self::$xdebug_table = new \swoole_table(1);
        self::$xdebug_table->column('wid', \swoole_table::TYPE_INT, 8);
        self::$xdebug_table->column('cid', \swoole_table::TYPE_INT, 8);
        self::$xdebug_table->create();
        self::$startTime = date('Y-m-d H:i:s');
        self::$startMillisecond = getMillisecond();
        self::setProcessTitle(getServerName());
        $application = new Application();
        $input = new ArgvInput();
        $output = new ConsoleOutput();
        self::$io = new SymfonyStyle($input, $output);
        self::addDirCommand(SERVER_DIR, "Server", $application);
        self::addDirCommand(APP_DIR, "app", $application);
        $application->run($input, $output);
    }