diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index d8ee9436b..41b76c3b5 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -428,7 +428,7 @@ class Perforce public function connectClient() { $p4CreateClientCommand = $this->generateP4Command( - 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()) + 'client -i < ' . ProcessExecutor::escape($this->getP4ClientSpec()) ); $this->executeCommand($p4CreateClientCommand); } diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index d8743f3d7..8d78eb425 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -339,7 +339,7 @@ class PerforceTest extends TestCase public function testConnectClient() { - $expectedCommand = 'p4 -u user -c composer_perforce_TEST_depot -p port client -i < path/composer_perforce_TEST_depot.p4.spec'; + $expectedCommand = 'p4 -u user -c composer_perforce_TEST_depot -p port client -i < '.ProcessExecutor::escape('path/composer_perforce_TEST_depot.p4.spec'); $this->processExecutor->expects($this->at(0)) ->method('execute') ->with($this->equalTo($expectedCommand), $this->equalTo(null))