Fix runLocally.

This commit is contained in:
Anton Medvedev 2015-05-13 10:17:53 +07:00
parent c578dd6bc5
commit 56ba9f7dae
2 changed files with 9 additions and 2 deletions

View File

@ -299,7 +299,7 @@ function run($command)
* Execute commands on local machine.
* @param string $command Command to run locally.
* @param int $timeout (optional) Override process command timeout in seconds.
* @return string Output of command.
* @return Result Output of command.
* @throws \RuntimeException
*/
function runLocally($command, $timeout = 60)
@ -312,7 +312,7 @@ function runLocally($command, $timeout = 60)
throw new \RuntimeException($process->getErrorOutput());
}
write($process->getOutput());
return new Result($process->getOutput());
}
/**

View File

@ -115,4 +115,11 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Deployer\Task\Scenario\Scenario', $mainScenario);
$this->assertEquals(['main', 'after'], $mainScenario->getTasks());
}
public function testRunLocally() {
$output = runLocally('echo "hello"');
$this->assertInstanceOf('Deployer\Type\Result', $output);
$this->assertEquals('hello', (string)$output);
}
}