mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
runLocally works like run.
This commit is contained in:
parent
56ba9f7dae
commit
3ff86dc927
@ -304,6 +304,12 @@ function run($command)
|
||||
*/
|
||||
function runLocally($command, $timeout = 60)
|
||||
{
|
||||
$command = env()->parse($command);
|
||||
|
||||
if (isVeryVerbose()) {
|
||||
writeln("<comment>Run locally</comment>: $command");
|
||||
}
|
||||
|
||||
$process = new Symfony\Component\Process\Process($command);
|
||||
$process->setTimeout($timeout);
|
||||
$process->run();
|
||||
@ -312,7 +318,15 @@ function runLocally($command, $timeout = 60)
|
||||
throw new \RuntimeException($process->getErrorOutput());
|
||||
}
|
||||
|
||||
return new Result($process->getOutput());
|
||||
$output = $process->getOutput();
|
||||
|
||||
if (isDebug() && !empty($output)) {
|
||||
writeln(array_map(function ($line) {
|
||||
return "<fg=red>></fg=red> $line";
|
||||
}, explode("\n", $output)));
|
||||
}
|
||||
|
||||
return new Result($output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@
|
||||
namespace Deployer;
|
||||
|
||||
use Deployer\Console\Application;
|
||||
use Deployer\Server\Environment;
|
||||
use Deployer\Task\Context;
|
||||
|
||||
class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||
@ -29,9 +30,10 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
|
||||
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
||||
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
||||
$server = $this->getMockBuilder('Deployer\Server\ServerInterface')->disableOriginalConstructor()->getMock();
|
||||
$env = $this->getMockBuilder('Deployer\Server\Environment')->disableOriginalConstructor()->getMock();
|
||||
$env = new Environment();
|
||||
|
||||
$this->deployer = new Deployer($this->console, $input, $output);
|
||||
Context::push(new Context($server, $env, $input, $output));
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
|
Loading…
x
Reference in New Issue
Block a user