Fixed shell plugin execution. Issue #30

This commit is contained in:
Dmitry Khomutov 2017-03-04 12:55:13 +07:00
parent f4b45e142e
commit 58875d5c8a
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
2 changed files with 14 additions and 17 deletions

View file

@ -77,10 +77,12 @@ abstract class BaseCommandExecutor implements CommandExecutorInterface
{
$this->lastOutput = [];
$command = call_user_func_array('sprintf', $args);
$this->logger->logDebug('Command: ' . $command);
$this->logger->logDebug('Args: ' . json_encode($args));
$command = call_user_func_array('sprintf', $args);
$this->logger->logDebug('Command: ' . $command);
if ($this->quiet) {
$this->logger->log('Executing: ' . $command);
}
@ -119,11 +121,12 @@ abstract class BaseCommandExecutor implements CommandExecutorInterface
}
$rtn = false;
if ($status == 0) {
$rtn = true;
}
$this->logger->logDebug('Execution status: ' . $status);
return $rtn;
}

View file

@ -1,11 +1,4 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCensor\Plugin;
@ -16,12 +9,13 @@ use PHPCensor\Plugin;
/**
* Shell Plugin - Allows execute shell commands.
*
* @author Kinn Coelho Julião <kinncj@gmail.com>
* @package PHPCI
* @subpackage Plugins
* @author Kinn Coelho Julião <kinncj@gmail.com>
*/
class Shell extends Plugin
{
/**
* @var array
*/
protected $args;
/**
@ -65,19 +59,19 @@ class Shell extends Plugin
/**
* Runs the shell command.
*
* @return bool
*/
public function execute()
{
$success = true;
foreach ($this->commands as $command) {
$command = $this->builder->interpolate($command);
if (!$this->builder->executeCommand($command)) {
$success = false;
return false;
}
}
return $success;
return true;
}
}