Running a command on local machine.
public runLocally ( string $commandline, array $options = [] ) : |
||
$commandline | string | |
$options | array | |
리턴 |
public function testRunLocally2() { $this->runtimeTask->getOutput()->setVerbosity(3); $node = new Node(); $node->setName("127.0.0.1"); $process = new Process($this->runtimeTask, $node); $os = php_uname('s'); if (preg_match('/Windows/i', $os)) { $process->runLocally(array("cd C:/Windows/Temp", "cd")); $output = $process->getRuntimeTask()->getOutput()->fetch(); $this->assertRegExp('/Real command: cmd.exe \\/C "cd C:\\/Windows\\/Temp & cd"/', $output); } else { $process->runLocally(array("cd /var/tmp", "pwd")); $output = $process->getRuntimeTask()->getOutput()->fetch(); $this->assertRegExp('/Real command: bash -l -c "cd \\/var\\/tmp && pwd"/', $output); } }