Execute the command.

@param bool $interactive
@param bool $blocking

@throws ProcessException
426135
private function exec($interactive = false, $blocking = self::NON_BLOCKING)
    {
        $this->validate();

        $this->resource = proc_open($this->command->serialize(),
                                    $this->descriptorspec,
                                    $this->pipes,
                                    $this->cwd,
                                    null);

        if ($this->resource === false) {
            throw new ProcessException('Call to [proc_open] failed.', $this);
        }

        $this->start = microtime(true);

        $this->running = true;

        if (!$interactive && isset($this->pipes[static::STDIN]) && is_resource($this->pipes[static::STDIN])) {
            fclose($this->pipes[static::STDIN]);
        }

        $this->setStreamBlocking($blocking);
    }
629802
public function execute($cmd, &$captureOutput = null)
    {
        $isInteractive = $this->container->get('INTERACTIVE');
        $process = $this->createProcess($isInteractive);

        if ($isInteractive) {
            $process->setCommandLine(sprintf('/bin/bash -c \'%s\'', $cmd));
        } else {
            $process->setInput($cmd);
        }

        if (null !== $captureOutput && false === $isInteractive) {
            $process->run(function ($type, $data) use(&$captureOutput) {
                $captureOutput .= $data;
            });
        } else {
            $process->run(array($this, 'processCallback'));
        }

        $ret = $process->getExitCode();

        if ($ret != 0) {
            if ((int)$ret == Container::ABORT_EXIT_CODE) {
                throw new ExecutionAbortedException("Command '$cmd' was aborted");
            } else {
                throw new \UnexpectedValueException("Command '$cmd' failed with exit code {$ret}");
            }
        }
        return $ret;
    }
491684
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $method = $this->method;
        $this->setHelperSet($this->getApplication()->getHelperSet());
        if ($this->argument != null) {
            $argument = $input->getArgument($this->argument);
            $this->$method($argument);

            return;
        }

        $this->$method($input,$output);
    }
814956
protected function _setBlock($block)
    {
        if ($block !== null && !($block instanceof BlockInterface)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Invalid block'),
                null,
                null,
                $block
            );
        }

        $this->block = $block;
    }
1293235
public function run()
    {
        $block = ob_get_clean();
        if ($this->renderInPlace) {
            throw new InvalidParamException("Not implemented yet ! ");
        }
        $block = trim($block);
        /*
        $jsBlockPattern  = '|^<script[^>]*>(.+?)</script>$|is';
        if(preg_match($jsBlockPattern,$block)){
            $block =  preg_replace ( $jsBlockPattern , '${1}'  , $block );
        }
        */
        $jsBlockPattern = '|^<script[^>]*>(?P<block_content>.+?)</script>$|is';
        if (preg_match($jsBlockPattern, $block, $matches)) {
            $block = $matches['block_content'];
        }

        $this->view->registerJs($block, $this->pos, $this->key);
    }
529215
public function addBlock(ExecutionBlockInterface $block): int
    {
        if ($block instanceof ProcedureBlockInterface) {
            $index = $this->serializeProcedure($block);
        } elseif ($block instanceof IfExpressionInterface) {
            $index = $this->serializeIfExpression($block);
        } elseif ($block instanceof AndExpressionInterface) {
            $index = $this->serializeAndExpression($block);
        } elseif ($block instanceof OrExpressionInterface) {
            $index = $this->serializeOrExpression($block);
        } else {
            // unknown execution block type
            throw new UnknownExecutionBlockType();
        }

        return $index;
    }
996136
public function execute() {
        if($this->blocking) {
            return $this->executeBlocking();
        } else {
            return $this->errorCheck(
                curl_multi_exec($this->handle,$active)
            );
        }
    }
5296
protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
    {
        $this->generatorService->process($input->getOption('force'));
        $output->writeln('Completed');
    }
94716
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->initialiseWorker($input, $output);
        $processes = $this->findWorkerTenderProcessesForTube($this->tube);
        if (count($processes) == 0) {
            $output->writeln("<info>Found no processes</info>");
            return;
        }
        $output->writeln('<info>Found ' . count($processes) . ' process(es)');
        foreach ($processes as $process) {
            $output->writeln('<info>sending kill to:</info> ' . $process);
            exec("kill $process");
        }
        $output->write('<info>Waiting on processes to stop</info> ');
        while (count($processes) > 0) {
            $processes = $this->findWorkerTenderProcessesForTube($this->tube);
            $output->write(".");
            sleep(1);

        }
        $output->writeln("Done!");
    }
1093772
def execute(self, processProtocol, command, env={},
                path=None, uid=None, gid=None, usePTY=0, childFDs=None):
        
        raise NotImplementedError()
83579
public function shutdown($block = true, $signal = SIGTERM)
    {
        if (empty($this->pid)) {
            throw new \LogicException('the process pid is null, so maybe the process is not started');
        }
        if (!$this->isRunning()) {
            throw new \LogicException("the process is not running");
        }
        if (!posix_kill($this->pid, $signal)) {
            throw new \RuntimeException("kill son process failed");
        }

        $this->updateStatus($block);
    }
655870
public function run($followingCommand = '')
    {
        $result = $this->execute('status', false)->getOutput();
        if (strpos($result, 'sock no such file') || strpos($result, 'refused connection')) {
            $command = sprintf(
                'supervisord%1$s%2$s%3$s',
                $this->configurationParameter,
                $this->identifierParameter,
                $followingCommand
            );
            $this->logger->debug('Executing: ' . $command);
            $p = new Process($command);
            $p->setWorkingDirectory($this->applicationDirectory);
            if (!$this->waitForSupervisord) {
                $p->start();
            } else {
                $p->run();
                if ($p->getExitCode() !== 0) {
                    $this->logger->critical(sprintf('supervisord returns code: %s', $p->getExitCodeText()));
                    throw new ProcessException($p);
                }
                $this->logger->debug('supervisord output: '. $p->getOutput());
            }
        }
    }
1315562
@Override
	public boolean execute(final ProcessInstance processInstance) {
		getBundleSelector().selectBundle(processInstance);
		List<Lock> locks = ContextUtils.getLocks(processInstance,getLockFactory(),"nz.co.senanque.workflow.Executor.execute(ProcessInstance)");
		LockTemplate lockTemplate = new LockTemplate(locks, new LockAction() {
			
			public void doAction() {
				log.debug("executing {}",processInstance.getId());
				getWorkflowManager().execute(processInstance.getId());
			}});
		return lockTemplate.doAction();
	}
676052
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($this->daemon)
        {
            if ($this->option('daemon'))
            {
                $_this = $this;

                $daemon         = new Daemon($this->app);
                $daemon->sleep  = $this->option('sleep');
                $daemon->memory = $this->option('memory');

                $daemon->log = function($msg) use ($_this) {
                    $_this->error($msg);
                };

                $daemon->run(function() use($_this) {
                    $_this->fire();
                });

                return true;
            }
        }

        $this->fire();
        return true;
    }
275499
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $processBuilder = ProcessBuilder::create([
            'drush',
            '--root=' . Platform::webDir(),
            '--uri=' . Platform::getUri()
        ]);
        foreach ($input->getArgument('cmd') as $argument) {
            $processBuilder->add($argument);
        }
        foreach ($input->getOption('drush_option') as $option) {
            $processBuilder->add($option);
        }

        if ($output->getVerbosity() > $output::VERBOSITY_NORMAL) {
            $output->writeln('Running drush command: <info>' . $processBuilder->getProcess()->getCommandLine() . '</info>');
        }

        passthru($processBuilder->getProcess()->getCommandLine());
    }
1064476
public function executeCommand($cmd, \Closure $closure = null, Process $process = null)
    {
        try {
            $cmd = $this->php.' '.$this->console.' '.$cmd;
            if (null === $process) {
                $process =  new Process($cmd);
            } else {
                $process->setCommandLine($cmd);
            }

            return $process->run($closure);
        } catch (\Exception $e) {
            return false;
        }
    }
1141667
function setBlocking(blocking) {
    var out = process.stdout, err = process.stderr;
    [out, err].forEach(function (stream) {
        if (stream._handle && stream.isTTY && chek_1.isFunction(stream._handle.setBlocking))
            stream._handle.setBlocking(blocking);
    });
}