Adding a debug mode to the worker so you can see what commands are being run.
This commit is contained in:
parent
068598d124
commit
3c74ca2281
|
@ -50,7 +50,8 @@ class WorkerCommand extends Command
|
|||
{
|
||||
$this
|
||||
->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)
|
||||
|
@ -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', []);
|
||||
|
||||
if (empty($config['host']) || empty($config['queue'])) {
|
||||
|
|
|
@ -90,6 +90,10 @@ abstract class BaseCommandExecutor implements CommandExecutor
|
|||
|
||||
$pipes = array();
|
||||
|
||||
if (defined('PHPCI_DEBUG_MODE')) {
|
||||
$this->logger->logDebug($command);
|
||||
}
|
||||
|
||||
$process = proc_open($command, $descriptorSpec, $pipes, $this->buildPath, null);
|
||||
|
||||
if (is_resource($process)) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class BuildLogger implements LoggerAwareInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a success-coloured message to the log.
|
||||
* @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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue