8000 bug #23498 [Process] Fixed issue between process builder and exec (ly… · symfony/symfony@5443599 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5443599

Browse files
bug #23498 [Process] Fixed issue between process builder and exec (lyrixx)
This PR was merged into the 3.3 branch. Discussion ---------- [Process] Fixed issue between process builder and exec | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes/ | Fixed tickets | #23495 | License | MIT | Doc PR | - Commits ------- 8cd1a2d [Process] Fixed issue between process builder and exec
2 parents e8b9e25 + 8cd1a2d commit 5443599

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-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 command
277+
$process->setCommandLine($process->getCommandLine());
275278

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

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,17 @@ public function testInvalidInput()
210210
$builder = ProcessBuilder::create();
211211
$builder->setInput(array());
212212
}
213+
214+
public function testDoesNotPrefixExec()
215+
{
216+
if ('\\' === DIRECTORY_SEPARATOR) {
217+
$this->markTestSkipped('This test cannot run on Windows.');
218+
}
219+
220+
$builder = ProcessBuilder::create(array('command', '-v', 'ls'));
221+
$process = $builder->getProcess();
222+
$process->run();
223+
224+
$this->assertTrue($process->isSuccessful());
225+
}
213226
}

0 commit comments

Comments
 (0)
0