public function processCommand(CliEngine $engine, $params = array(), $injectables = null)
{
// we need to wrap our code to catch old-style PHP errors
$legacyHandler = new Legacy_ErrorHandler();
// run our code
try {
$returnCode = $legacyHandler->run([$this, 'processInsideLegacyHandler'], [$engine, $params, $injectables]);
return $returnCode;
} catch (Exception $e) {
$injectables->output->logCliError($e->getMessage());
$engine->options->dev = true;
if (isset($engine->options->dev) && $engine->options->dev) {
$injectables->output->logCliError("Stack trace is:\n\n" . $e->getTraceAsString());
}
// stop the browser if available
if (isset($this->st)) {
$this->st->stopDevice();
}
// tell the calling process that things did not end well
exit(1);
}
}