Feature: interop env on localhost with once().

This commit is contained in:
Anton Medvedev 2016-11-12 17:42:03 +07:00
parent 2959ecaa72
commit afba2ec798
2 changed files with 16 additions and 2 deletions

View File

@ -120,6 +120,16 @@ class ParallelExecutor implements ExecutorInterface
*/
private $hasNonFatalException = false;
/**
* @var Local
*/
private $localhost;
/**
* @var Environment
*/
private $localEnv;
/**
* @param InputDefinition $userDefinition
*/
@ -139,6 +149,8 @@ class ParallelExecutor implements ExecutorInterface
$this->input = $input;
$this->output = new OutputWatcher($output);
$this->informer = new Informer($this->output);
$this->localhost = new Local();
$this->localEnv = new Environment();
$this->port = self::START_PORT;
connect:
@ -292,7 +304,7 @@ class ParallelExecutor implements ExecutorInterface
$this->informer->startTask($taskName);
if ($task->isOnce()) {
$task->run(new Context(new Local(), new Environment(), $this->input, $this->output));
$task->run(new Context($this->localhost, $this->localEnv, $this->input, $this->output));
$this->informer->endTask();
} else {
$this->tasksToDo = [];

View File

@ -22,13 +22,15 @@ class SeriesExecutor implements ExecutorInterface
{
$output = new OutputWatcher($output);
$informer = new Informer($output);
$localhost = new Local();
$localEnv = new Environment();
foreach ($tasks as $task) {
$success = true;
$informer->startTask($task->getName());
if ($task->isOnce()) {
$task->run(new Context(new Local(), new Environment(), $input, $output));
$task->run(new Context($localhost, $localEnv, $input, $output));
} else {
foreach ($servers as $serverName => $server) {
if ($task->isOnServer($serverName)) {