Explorar el Código

ProcessExecutor::escape

frederik hace 10 años
padre
commit
d1d40502bf

+ 2 - 2
src/Composer/Command/HomeCommand.php

@@ -18,12 +18,12 @@ use Composer\Package\CompletePackageInterface;
 use Composer\Package\Loader\InvalidPackageException;
 use Composer\Repository\CompositeRepository;
 use Composer\Repository\RepositoryInterface;
+use Composer\Util\ProcessExecutor;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Process\Exception\InvalidArgumentException;
-use Composer\Util\ProcessUtil;
 
 /**
  * @author Robert Schönthal <seroscho@googlemail.com>
@@ -121,7 +121,7 @@ EOT
      */
     private function openBrowser($url)
     {
-        $url = ProcessUtil::escapeArgument($url);
+        $url = ProcessExecutor::escape($url);
 
         if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
             return passthru('start "web" explorer "' . $url . '"');

+ 2 - 2
src/Composer/Command/InitCommand.php

@@ -20,7 +20,7 @@ use Composer\Package\Version\VersionSelector;
 use Composer\Repository\CompositeRepository;
 use Composer\Repository\PlatformRepository;
 use Composer\Package\Version\VersionParser;
-use Composer\Util\ProcessUtil;
+use Composer\Util\ProcessExecutor;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
@@ -439,7 +439,7 @@ EOT
         $finder = new ExecutableFinder();
         $gitBin = $finder->find('git');
 
-        $cmd = new Process(sprintf('%s config -l', ProcessUtil::escapeArgument($gitBin)));
+        $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
         $cmd->run();
 
         if ($cmd->isSuccessful()) {

+ 12 - 13
src/Composer/Downloader/GitDownloader.php

@@ -19,7 +19,6 @@ use Composer\Util\ProcessExecutor;
 use Composer\IO\IOInterface;
 use Composer\Util\Filesystem;
 use Composer\Config;
-use Composer\Util\ProcessUtil;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -51,9 +50,9 @@ class GitDownloader extends VcsDownloader
         $commandCallable = function ($url) use ($ref, $path, $command) {
             return sprintf(
             		$command,
-            		ProcessUtil::escapeArgument($url),
-            		ProcessUtil::escapeArgument($path),
-            		ProcessUtil::escapeArgument($ref));
+            		ProcessExecutor::escape($url),
+            		ProcessExecutor::escape($path),
+            		ProcessExecutor::escape($ref));
         };
 
         $this->gitUtil->runCommand($commandCallable, $url, $path, true);
@@ -83,7 +82,7 @@ class GitDownloader extends VcsDownloader
         $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
 
         $commandCallable = function ($url) use ($command) {
-            return sprintf($command, ProcessUtil::escapeArgument ($url));
+            return sprintf($command, ProcessExecutor::escape ($url));
         };
 
         $this->gitUtil->runCommand($commandCallable, $url, $path);
@@ -230,7 +229,7 @@ class GitDownloader extends VcsDownloader
             && $branches
             && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
         ) {
-            $command = sprintf('git checkout -B %s %s && git reset --hard %2$s', ProcessUtil::escapeArgument($branch), ProcessUtil::escapeArgument('composer/'.$reference));
+            $command = sprintf('git checkout -B %s %s && git reset --hard %2$s', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
             if (0 === $this->process->execute($command, $output, $path)) {
                 return;
             }
@@ -243,19 +242,19 @@ class GitDownloader extends VcsDownloader
                 $branch = 'v' . $branch;
             }
 
-            $command = sprintf('git checkout %s', ProcessUtil::escapeArgument($branch));
-            $fallbackCommand = sprintf('git checkout -B %s %s', ProcessUtil::escapeArgument($branch), ProcessUtil::escapeArgument('composer/'.$branch));
+            $command = sprintf('git checkout %s', ProcessExecutor::escape($branch));
+            $fallbackCommand = sprintf('git checkout -B %s %s', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
             if (0 === $this->process->execute($command, $output, $path)
                 || 0 === $this->process->execute($fallbackCommand, $output, $path)
             ) {
-                $command = sprintf('git reset --hard %s', ProcessUtil::escapeArgument($reference));
+                $command = sprintf('git reset --hard %s', ProcessExecutor::escape($reference));
                 if (0 === $this->process->execute($command, $output, $path)) {
                     return;
                 }
             }
         }
 
-        $command = sprintf($template, ProcessUtil::escapeArgument($gitRef));
+        $command = sprintf($template, ProcessExecutor::escape($gitRef));
         if (0 === $this->process->execute($command, $output, $path)) {
             return;
         }
@@ -274,7 +273,7 @@ class GitDownloader extends VcsDownloader
             foreach ($this->process->splitLines($output) as $line) {
                 if (preg_match('{^composer/'.preg_quote($branch).'(?:\.x)?$}i', trim($line))) {
                     // find the previous commit by date in the given branch
-                    if (0 === $this->process->execute(sprintf($guessTemplate, $date, ProcessUtil::escapeArgument(trim($line))), $output, $path)) {
+                    if (0 === $this->process->execute(sprintf($guessTemplate, $date, ProcessExecutor::escape(trim($line))), $output, $path)) {
                         $newReference = trim($output);
                     }
 
@@ -291,7 +290,7 @@ class GitDownloader extends VcsDownloader
             }
 
             // checkout the new recovered ref
-            $command = sprintf($template, ProcessUtil::escapeArgument($newReference));
+            $command = sprintf($template, ProcessExecutor::escape($newReference));
             if (0 === $this->process->execute($command, $output, $path)) {
                 $this->io->write('    '.$reference.' is gone (history was rewritten?), recovered by checking out '.$newReference);
 
@@ -311,7 +310,7 @@ class GitDownloader extends VcsDownloader
             if ($protocols[0] !== 'git') {
                 $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
             }
-            $cmd = sprintf('git remote set-url --push origin %s', ProcessUtil::escapeArgument($pushUrl));
+            $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
             $this->process->execute($cmd, $ignoredOutput, $path);
         }
     }

+ 1 - 2
src/Composer/Downloader/GzipDownloader.php

@@ -18,7 +18,6 @@ use Composer\EventDispatcher\EventDispatcher;
 use Composer\Package\PackageInterface;
 use Composer\Util\ProcessExecutor;
 use Composer\IO\IOInterface;
-use Composer\Util\ProcessUtil;
 
 /**
  * GZip archive downloader.
@@ -41,7 +40,7 @@ class GzipDownloader extends ArchiveDownloader
 
         // Try to use gunzip on *nix
         if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
-            $command = 'gzip -cd ' . ProcessUtil::escapeArgument($file) . ' > ' . ProcessUtil::escapeArgument($targetFilepath);
+            $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
 
             if (0 === $this->process->execute($command, $ignoredOutput)) {
                 return;

+ 6 - 6
src/Composer/Downloader/HgDownloader.php

@@ -13,7 +13,7 @@
 namespace Composer\Downloader;
 
 use Composer\Package\PackageInterface;
-use Composer\Util\ProcessUtil;
+use Composer\Util\ProcessExecutor;
 
 /**
  * @author Per Bernhardt <plb@webfactory.de>
@@ -25,10 +25,10 @@ class HgDownloader extends VcsDownloader
      */
     public function doDownload(PackageInterface $package, $path, $url)
     {
-        $url = ProcessUtil::escapeArgument($url);
-        $ref = ProcessUtil::escapeArgument($package->getSourceReference());
+        $url = ProcessExecutor::escape($url);
+        $ref = ProcessExecutor::escape($package->getSourceReference());
         $this->io->write("    Cloning ".$package->getSourceReference());
-        $command = sprintf('hg clone %s %s', $url, ProcessUtil::escapeArgument($path));
+        $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
         if (0 !== $this->process->execute($command, $ignoredOutput)) {
             throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
         }
@@ -43,8 +43,8 @@ class HgDownloader extends VcsDownloader
      */
     public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
     {
-        $url = ProcessUtil::escapeArgument($url);
-        $ref = ProcessUtil::escapeArgument($target->getSourceReference());
+        $url = ProcessExecutor::escape($url);
+        $ref = ProcessExecutor::escape($target->getSourceReference());
         $this->io->write("    Updating to ".$target->getSourceReference());
 
         if (!is_dir($path.'/.hg')) {

+ 1 - 2
src/Composer/Downloader/RarDownloader.php

@@ -18,7 +18,6 @@ use Composer\EventDispatcher\EventDispatcher;
 use Composer\Util\ProcessExecutor;
 use Composer\IO\IOInterface;
 use RarArchive;
-use Composer\Util\ProcessUtil;
 
 /**
  * RAR archive downloader.
@@ -43,7 +42,7 @@ class RarDownloader extends ArchiveDownloader
 
         // Try to use unrar on *nix
         if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
-            $command = 'unrar x ' . ProcessUtil::escapeArgument($file) . ' ' . ProcessUtil::escapeArgument($path) . ' && chmod -R u+w ' . ProcessUtil::escapeArgument($path);
+            $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' && chmod -R u+w ' . ProcessExecutor::escape($path);
 
             if (0 === $this->process->execute($command, $ignoredOutput)) {
                 return;

+ 1 - 2
src/Composer/Downloader/ZipDownloader.php

@@ -18,7 +18,6 @@ use Composer\EventDispatcher\EventDispatcher;
 use Composer\Util\ProcessExecutor;
 use Composer\IO\IOInterface;
 use ZipArchive;
-use Composer\Util\ProcessUtil;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -39,7 +38,7 @@ class ZipDownloader extends ArchiveDownloader
 
         // try to use unzip on *nix
         if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
-            $command = 'unzip '.ProcessUtil::escapeArgument($file).' -d '.ProcessUtil::escapeArgument($path) . ' && chmod -R u+w ' . ProcessUtil::escapeArgument($path);
+            $command = 'unzip '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path) . ' && chmod -R u+w ' . ProcessExecutor::escape($path);
             try {
                 if (0 === $this->process->execute($command, $ignoredOutput)) {
                     return;

+ 1 - 2
src/Composer/EventDispatcher/EventDispatcher.php

@@ -19,7 +19,6 @@ use Composer\Script;
 use Composer\Script\CommandEvent;
 use Composer\Script\PackageEvent;
 use Composer\Util\ProcessExecutor;
-use Composer\Util\ProcessUtil;
 
 /**
  * The Event Dispatcher.
@@ -153,7 +152,7 @@ class EventDispatcher
                     throw $e;
                 }
             } else {
-                $args = implode(' ', array_map(array('Composer\Util\ProcessUtil','escapeArgument'), $event->getArguments()));
+                $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor','escape'), $event->getArguments()));
                 if (0 !== ($exitCode = $this->process->execute($callable . ($args === '' ? '' : ' '.$args)))) {
                     $event->getIO()->write(sprintf('<error>Script %s handling the %s event returned with an error</error>', $callable, $event->getName()));
 

+ 3 - 3
src/Composer/Installer/LibraryInstaller.php

@@ -17,7 +17,7 @@ use Composer\IO\IOInterface;
 use Composer\Repository\InstalledRepositoryInterface;
 use Composer\Package\PackageInterface;
 use Composer\Util\Filesystem;
-use Composer\Util\ProcessUtil;
+use Composer\Util\ProcessExecutor;
 
 /**
  * Package installation manager.
@@ -297,7 +297,7 @@ class LibraryInstaller implements InstallerInterface
         }
 
         return "@ECHO OFF\r\n".
-            "SET BIN_TARGET=%~dp0/".trim(ProcessUtil::escapeArgument($binPath), '"')."\r\n".
+            "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"')."\r\n".
             "{$caller} \"%BIN_TARGET%\" %*\r\n";
     }
 
@@ -308,7 +308,7 @@ class LibraryInstaller implements InstallerInterface
         return "#!/usr/bin/env sh\n".
             'SRC_DIR="`pwd`"'."\n".
             'cd "`dirname "$0"`"'."\n".
-            'cd '.ProcessUtil::escapeArgument(dirname($binPath))."\n".
+            'cd '.ProcessExecutor::escape(dirname($binPath))."\n".
             'BIN_TARGET="`pwd`/'.basename($binPath)."\"\n".
             'cd "$SRC_DIR"'."\n".
             '"$BIN_TARGET" "$@"'."\n";

+ 3 - 2
src/Composer/Installer/PearInstaller.php

@@ -17,6 +17,7 @@ use Composer\Composer;
 use Composer\Downloader\PearPackageExtractor;
 use Composer\Repository\InstalledRepositoryInterface;
 use Composer\Package\PackageInterface;
+use Composer\Util\ProcessExecutor;
 
 /**
  * Package installation manager.
@@ -124,7 +125,7 @@ class PearInstaller extends LibraryInstaller
                     "pushd .\r\n".
                     "cd %~dp0\r\n".
                     "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
-                    "cd ".ProcessUtil::escapeArgument(dirname($binPath))."\r\n".
+                    "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
                     "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
                     "popd\r\n".
                     "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
@@ -134,7 +135,7 @@ class PearInstaller extends LibraryInstaller
         return "@echo off\r\n".
             "pushd .\r\n".
             "cd %~dp0\r\n".
-            "cd ".ProcessUtil::escapeArgument(dirname($binPath))."\r\n".
+            "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
             "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
             "popd\r\n".
             $caller." \"%BIN_TARGET%\" %*\r\n";

+ 2 - 3
src/Composer/Package/Locker.php

@@ -22,7 +22,6 @@ use Composer\Package\Loader\ArrayLoader;
 use Composer\Package\Version\VersionParser;
 use Composer\Util\Git as GitUtil;
 use Composer\IO\IOInterface;
-use Composer\Util\ProcessUtil;
 
 /**
  * Reads/writes project lockfile (composer.lock).
@@ -342,13 +341,13 @@ class Locker
                 case 'git':
                     GitUtil::cleanEnv();
 
-                    if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessUtil::escapeArgument($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
+                    if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
                         $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
                     }
                     break;
 
                 case 'hg':
-                    if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessUtil::escapeArgument($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
+                    if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
                         $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
                     }
                     break;

+ 4 - 5
src/Composer/Repository/Vcs/GitDriver.php

@@ -19,7 +19,6 @@ use Composer\Util\Git as GitUtil;
 use Composer\IO\IOInterface;
 use Composer\Cache;
 use Composer\Config;
-use Composer\Util\ProcessUtil;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -63,7 +62,7 @@ class GitDriver extends VcsDriver
             if (is_dir($this->repoDir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $this->repoDir) && trim($output) === '.') {
                 try {
                     $commandCallable = function ($url) {
-                        return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessUtil::escapeArgument($url));
+                        return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
                     };
                     $gitUtil->runCommand($commandCallable, $this->url, $this->repoDir);
                 } catch (\Exception $e) {
@@ -75,7 +74,7 @@ class GitDriver extends VcsDriver
 
                 $repoDir = $this->repoDir;
                 $commandCallable = function ($url) use ($repoDir) {
-                    return sprintf('git clone --mirror %s %s', ProcessUtil::escapeArgument($url), ProcessUtil::escapeArgument($repoDir));
+                    return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
                 };
 
                 $gitUtil->runCommand($commandCallable, $this->url, $this->repoDir, true);
@@ -148,7 +147,7 @@ class GitDriver extends VcsDriver
         }
 
         if (!isset($this->infoCache[$identifier])) {
-            $resource = sprintf('%s:composer.json', ProcessUtil::escapeArgument($identifier));
+            $resource = sprintf('%s:composer.json', ProcessExecutor::escape($identifier));
             $this->process->execute(sprintf('git show %s', $resource), $composer, $this->repoDir);
 
             if (!trim($composer)) {
@@ -158,7 +157,7 @@ class GitDriver extends VcsDriver
             $composer = JsonFile::parseJson($composer, $resource);
 
             if (!isset($composer['time'])) {
-                $this->process->execute(sprintf('git log -1 --format=%%at %s', ProcessUtil::escapeArgument($identifier)), $output, $this->repoDir);
+                $this->process->execute(sprintf('git log -1 --format=%%at %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
                 $date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
                 $composer['time'] = $date->format('Y-m-d H:i:s');
             }

+ 4 - 5
src/Composer/Repository/Vcs/HgDriver.php

@@ -17,7 +17,6 @@ use Composer\Json\JsonFile;
 use Composer\Util\ProcessExecutor;
 use Composer\Util\Filesystem;
 use Composer\IO\IOInterface;
-use Composer\Util\ProcessUtil;
 
 /**
  * @author Per Bernhardt <plb@webfactory.de>
@@ -57,7 +56,7 @@ class HgDriver extends VcsDriver
                 // clean up directory and do a fresh clone into it
                 $fs->removeDirectory($this->repoDir);
 
-                if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessUtil::escapeArgument($this->url), ProcessUtil::escapeArgument($this->repoDir)), $output, $cacheDir)) {
+                if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
                     $output = $this->process->getErrorOutput();
 
                     if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
@@ -117,7 +116,7 @@ class HgDriver extends VcsDriver
     public function getComposerInformation($identifier)
     {
         if (!isset($this->infoCache[$identifier])) {
-            $this->process->execute(sprintf('hg cat -r %s composer.json', ProcessUtil::escapeArgument($identifier)), $composer, $this->repoDir);
+            $this->process->execute(sprintf('hg cat -r %s composer.json', ProcessExecutor::escape($identifier)), $composer, $this->repoDir);
 
             if (!trim($composer)) {
                 return;
@@ -126,7 +125,7 @@ class HgDriver extends VcsDriver
             $composer = JsonFile::parseJson($composer, $identifier);
 
             if (!isset($composer['time'])) {
-                $this->process->execute(sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessUtil::escapeArgument($identifier)), $output, $this->repoDir);
+                $this->process->execute(sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
                 $date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
                 $composer['time'] = $date->format('Y-m-d H:i:s');
             }
@@ -216,7 +215,7 @@ class HgDriver extends VcsDriver
         }
 
         $processExecutor = new ProcessExecutor();
-        $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessUtil::escapeArgument($url)), $ignored);
+        $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
 
         return $exit === 0;
     }

+ 4 - 4
src/Composer/Util/Filesystem.php

@@ -112,9 +112,9 @@ class Filesystem
         }
 
         if (defined('PHP_WINDOWS_VERSION_BUILD')) {
-            $cmd = sprintf('rmdir /S /Q %s', ProcessUtil::escapeArgument(realpath($directory)));
+            $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
         } else {
-            $cmd = sprintf('rm -rf %s', ProcessUtil::escapeArgument($directory));
+            $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
         }
 
         $result = $this->getProcess()->execute($cmd, $output) === 0;
@@ -269,7 +269,7 @@ class Filesystem
 
         if (defined('PHP_WINDOWS_VERSION_BUILD')) {
             // Try to copy & delete - this is a workaround for random "Access denied" errors.
-            $command = sprintf('xcopy %s %s /E /I /Q', ProcessUtil::escapeArgument($source), ProcessUtil::escapeArgument($target));
+            $command = sprintf('xcopy %s %s /E /I /Q', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
             $result = $this->processExecutor->execute($command, $output);
 
             // clear stat cache because external processes aren't tracked by the php stat cache
@@ -283,7 +283,7 @@ class Filesystem
         } else {
             // We do not use PHP's "rename" function here since it does not support
             // the case where $source, and $target are located on different partitions.
-            $command = sprintf('mv %s %s', ProcessUtil::escapeArgument($source), ProcessUtil::escapeArgument($target));
+            $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
             $result = $this->processExecutor->execute($command, $output);
 
             // clear stat cache because external processes aren't tracked by the php stat cache

+ 14 - 0
src/Composer/Util/ProcessExecutor.php

@@ -13,6 +13,7 @@
 namespace Composer\Util;
 
 use Symfony\Component\Process\Process;
+use Symfony\Component\Process\ProcessUtils;
 use Composer\IO\IOInterface;
 
 /**
@@ -104,4 +105,17 @@ class ProcessExecutor
     {
         static::$timeout = $timeout;
     }
+    
+    /**
+     * Escapes a string to be used as a shell argument.
+     *
+     * @param string $argument The argument that will be escaped
+     *
+     * @return string The escaped argument
+     */
+    
+    public static function escape ($argument)
+    {
+    	return ProcessUtils::escapeArgument($argument);
+    }
 }

+ 0 - 37
src/Composer/Util/ProcessUtil.php

@@ -1,37 +0,0 @@
-<?php
-
-/*
- * This file is part of Composer.
- *
- * (c) Nils Adermann <naderman@naderman.de>
- *     Jordi Boggiano <j.boggiano@seld.be>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Composer\Util;
-
-use Symfony\Component\Process\ProcessUtils;
-
-/**
- * @author Frederik Bosch <f.bosch@genkgo.nl>
- */
-
-class ProcessUtil
-{
-    
-	/**
-	 * Escapes a string to be used as a shell argument.
-	 *
-	 * @param string $argument The argument that will be escaped
-	 *
-	 * @return string The escaped argument
-	 */
-	public static function escapeArgument ($argument)
-	{
-		return ProcessUtils::escapeArgument($argument);
-	}
-	
-	
-}

+ 4 - 4
src/Composer/Util/Svn.php

@@ -188,11 +188,11 @@ class Svn
             $cmd,
             '--non-interactive ',
             $this->getCredentialString(),
-            ProcessUtil::escapeArgument($url)
+            ProcessExecutor::escape($url)
         );
 
         if ($path) {
-            $cmd .= ' ' . ProcessUtil::escapeArgument($path);
+            $cmd .= ' ' . ProcessExecutor::escape($path);
         }
 
         return $cmd;
@@ -214,8 +214,8 @@ class Svn
         return sprintf(
             ' %s--username %s --password %s ',
             $this->getAuthCache(),
-            ProcessUtil::escapeArgument($this->getUsername()),
-            ProcessUtil::escapeArgument($this->getPassword())
+            ProcessExecutor::escape($this->getUsername()),
+            ProcessExecutor::escape($this->getPassword())
         );
     }