8000 [Process] Fixed issue between process builder and exec · symfony/symfony@8cd1a2d · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8cd1a2d

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

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