Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c0b731

Browse files
committed
[Process] Fixed issue between process builder and exec
refs #23495
1 parent e8b9e25 commit 8c0b731

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Symfony/Component/Process/ProcessBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ public function getProcess()
272272

273273
$arguments = array_merge($this->prefix, $this->arguments);
274274
$process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options);
275+
// to preserve the BC with symfony <3.3, we convert the array structure
276+
// to a string structure to avoid the prefixing with the exec binary
277+
$process->setCommandLine($process->getCommandLine());
275278

276279
if ($this->inheritEnv) {
277280
$process->inheritEnvironmentVariables();

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,16 @@ public function testInvalidInput()
210210
$builder = ProcessBuilder::create();
211211
$builder->setInput(array());
212212
}
213+
214+
public function testDoesNotPrefixExec()
215+
{
216+
$builder = ProcessBuilder::create(['a', 'b']);
217+
$process = $builder->getProcess();
218+
219+
$r = new \ReflectionObject($process);
220+
$p = $r->getProperty('commandline');
221+
$p->setAccessible(true);
222+
223+
$this->assertSame("'a' 'b'", $p->getValue($process));
224+
}
213225
}

0 commit comments

Comments
 (0)