Adding a debug mode to the worker so you can see what commands are being run.
This commit is contained in:
parent
5ead42a7c2
commit
21d5f4954f
|
@ -50,7 +50,8 @@ class WorkerCommand extends Command
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('phpci:worker')
|
->setName('phpci:worker')
|
||||||
->setDescription('Runs the PHPCI build worker.');
|
->setDescription('Runs the PHPCI build worker.')
|
||||||
|
->addOption('debug', null, null, 'Run PHPCI in Debug Mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
@ -65,6 +66,12 @@ class WorkerCommand extends Command
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow PHPCI to run in "debug mode"
|
||||||
|
if ($input->hasOption('debug') && $input->getOption('debug')) {
|
||||||
|
$output->writeln('<comment>Debug mode enabled.</comment>');
|
||||||
|
define('PHPCI_DEBUG_MODE', true);
|
||||||
|
}
|
||||||
|
|
||||||
$config = Config::getInstance()->get('phpci.worker', []);
|
$config = Config::getInstance()->get('phpci.worker', []);
|
||||||
|
|
||||||
if (empty($config['host']) || empty($config['queue'])) {
|
if (empty($config['host']) || empty($config['queue'])) {
|
||||||
|
|
|
@ -90,6 +90,10 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
||||||
|
|
||||||
$pipes = array();
|
$pipes = array();
|
||||||
|
|
||||||
|
if (defined('PHPCI_DEBUG_MODE')) {
|
||||||
|
$this->logger->logDebug($command);
|
||||||
|
}
|
||||||
|
|
||||||
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
||||||
|
|
||||||
if (is_resource($process)) {
|
if (is_resource($process)) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class BuildLogger implements LoggerAwareInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a success-coloured message to the log.
|
* Add a success-coloured message to the log.
|
||||||
* @param string
|
* @param string
|
||||||
*/
|
*/
|
||||||
|
@ -98,6 +98,15 @@ class BuildLogger implements LoggerAwareInterface
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a debug message to the log.
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public function logDebug($message)
|
||||||
|
{
|
||||||
|
$this->log("\033[0;33m" . $message . "\033[0m");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a logger instance on the object
|
* Sets a logger instance on the object
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue