Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Attempting to suppress STDERR output across all systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Jun 6, 2013
1 parent d768add commit f6454cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/Eloquent/Liftoff/Launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,22 @@ protected function launchCommand($command, array $arguments)
)
);

$handle = $this->isolator->proc_open($command, array(), $pipes);
$handle = $this->isolator->proc_open(
$command,
array(
array('pipe', 'r'),
array('pipe', 'w'),
array('pipe', 'w'),
),
$pipes
);
if (false === $handle) {
throw new Exception\LaunchException($arguments[0]);
}

foreach ($pipes as $pipe) {
$this->isolator->fclose($pipe);
}
$this->isolator->proc_close($handle);
}

Expand Down
16 changes: 14 additions & 2 deletions test/suite/Eloquent/Liftoff/LauncherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,26 @@ public function launchData()
*/
public function testLaunch($os, $target, $arguments, $expectedCommand)
{
$expectedDescriptorSpec = array(
array('pipe', 'r'),
array('pipe', 'w'),
array('pipe', 'w'),
);
Phake::when($this->isolator)->php_uname('s')->thenReturn($os);
Phake::when($this->isolator)
->proc_open(Phake::anyParameters())
->proc_open($expectedCommand, $expectedDescriptorSpec, Phake::setReference(array(222, 333, 444)))
->thenReturn(111);
$this->launcher->launch($target, $arguments);

Phake::inOrder(
Phake::verify($this->isolator)->proc_open($expectedCommand, array(), null),
Phake::verify($this->isolator)->proc_open(
$expectedCommand,
$expectedDescriptorSpec,
null
),
Phake::verify($this->isolator)->fclose(222),
Phake::verify($this->isolator)->fclose(333),
Phake::verify($this->isolator)->fclose(444),
Phake::verify($this->isolator)->proc_close(111)
);
}
Expand Down

0 comments on commit f6454cd

Please sign in to comment.