Esempio n. 1
0
 public function run(Directory $workingDirectory, Argument ...$arguments) : Result
 {
     $descriptorSpec = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']];
     $process = proc_open($this->buildCommand(...$arguments), $descriptorSpec, $pipes, $workingDirectory->getPath());
     $stdOut = stream_get_contents($pipes[1]);
     $stdErr = stream_get_contents($pipes[2]);
     foreach ($pipes as $pipe) {
         fclose($pipe);
     }
     return new Result(proc_close($process), $stdOut, $stdErr);
 }
Esempio n. 2
0
 public function testGetPath()
 {
     $existentDirectory = DATA_DIR . '/existing-directory';
     $directory = new Directory($existentDirectory);
     $this->assertSame($existentDirectory, $directory->getPath());
 }