Skip to content

Commit 6e1ae53

Browse files
Minor fixes
1 parent 0020680 commit 6e1ae53

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/Symfony/Component/Process/PhpExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function find($includeArgs = true)
3737
{
3838
// HHVM support
3939
if (defined('HHVM_VERSION')) {
40-
return (false !== (getenv('PHP_BINARY')) ?: PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
40+
return (getenv('PHP_BINARY') ?: PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
4141
}
4242

4343
// PHP_BINARY return the current sapi executable

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function testAllOutputIsActuallyReadOnTermination()
102102
$expectedOutputSize = ProcessPipes::CHUNK_SIZE * 2 + 2;
103103

104104
$code = sprintf('echo str_repeat(\'*\', %d);', $expectedOutputSize);
105-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
105+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
106106

107107
$p->start();
108108
// Let's wait enough time for process to finish...
@@ -141,7 +141,7 @@ public function testCallbacksAreExecutedWithStart()
141141
*/
142142
public function testProcessResponses($expected, $getter, $code)
143143
{
144-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
144+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
145145
$p->run();
146146

147147
$this->assertSame($expected, $p->$getter());
@@ -157,7 +157,7 @@ public function testProcessPipes($code, $size)
157157
$expected = str_repeat(str_repeat('*', 1024), $size).'!';
158158
$expectedLength = (1024 * $size) + 1;
159159

160-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg($code)));
160+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg($code)));
161161
$p->setStdin($expected);
162162
$p->run();
163163

@@ -246,7 +246,7 @@ public function testChainedCommandsOutput($expected, $operator, $input)
246246

247247
public function testCallbackIsExecutedForOutput()
248248
{
249-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('echo \'foo\';')));
249+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('echo \'foo\';')));
250250

251251
$called = false;
252252
$p->run(function ($type, $buffer) use (&$called) {
@@ -258,7 +258,7 @@ public function testCallbackIsExecutedForOutput()
258258

259259
public function testGetErrorOutput()
260260
{
261-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
261+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; }')));
262262

263263
$p->run();
264264
$this->assertEquals(3, preg_match_all('/ERROR/', $p->getErrorOutput(), $matches));
@@ -271,7 +271,7 @@ public function testGetIncrementalErrorOutput()
271271
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
272272
file_put_contents($lock, 'W');
273273

274-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
274+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
275275

276276
$p->start();
277277
while ($p->isRunning()) {
@@ -292,7 +292,7 @@ public function testGetEmptyIncrementalErrorOutput()
292292
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
293293
file_put_contents($lock, 'W');
294294

295-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
295+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
296296

297297
$p->start();
298298

@@ -318,7 +318,7 @@ public function testGetEmptyIncrementalErrorOutput()
318318

319319
public function testGetOutput()
320320
{
321-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }')));
321+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { echo \' foo \'; $n++; }')));
322322

323323
$p->run();
324324
$this->assertEquals(3, preg_match_all('/foo/', $p->getOutput(), $matches));
@@ -331,7 +331,7 @@ public function testGetIncrementalOutput()
331331
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
332332
file_put_contents($lock, 'W');
333333

334-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
334+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
335335

336336
$p->start();
337337
while ($p->isRunning()) {
@@ -352,7 +352,7 @@ public function testGetEmptyIncrementalOutput()
352352
$lock = tempnam(sys_get_temp_dir(), get_class($this).'Lock');
353353
file_put_contents($lock, 'W');
354354

355-
$p = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
355+
$p = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents('.var_export($lock, true).')) { echo \' foo \'; $n++; file_put_contents('.var_export($lock, true).', \'R\'); } usleep(100); }')));
356356

357357
$p->start();
358358

@@ -733,7 +733,7 @@ public function testCheckTimeoutOnStartedProcess()
733733

734734
public function testStartAfterATimeout()
735735
{
736-
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }')));
736+
$process = $this->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 1000; while ($n--) {echo \'\'; usleep(1000); }')));
737737
$process->setTimeout(0.1);
738738
try {
739739
$process->run();

0 commit comments

Comments
 (0)