1
0
Fork 0

Output VcsDownloader process commands in -vvv mode

pull/1573/merge
Jordi Boggiano 2013-04-28 11:12:42 +02:00
parent 3fd883a489
commit 5cdf40d165
2 changed files with 13 additions and 1 deletions

View File

@ -33,7 +33,7 @@ abstract class VcsDownloader implements DownloaderInterface
{ {
$this->io = $io; $this->io = $io;
$this->config = $config; $this->config = $config;
$this->process = $process ?: new ProcessExecutor; $this->process = $process ?: new ProcessExecutor($io);
$this->filesystem = $fs ?: new Filesystem; $this->filesystem = $fs ?: new Filesystem;
} }

View File

@ -13,6 +13,7 @@
namespace Composer\Util; namespace Composer\Util;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Composer\IO\IOInterface;
/** /**
* @author Robert Schönthal <seroscho@googlemail.com> * @author Robert Schönthal <seroscho@googlemail.com>
@ -23,6 +24,12 @@ class ProcessExecutor
protected $captureOutput; protected $captureOutput;
protected $errorOutput; protected $errorOutput;
protected $io;
public function __construct(IOInterface $io = null)
{
$this->io = $io;
}
/** /**
* runs a process on the commandline * runs a process on the commandline
@ -39,6 +46,11 @@ class ProcessExecutor
$this->errorOutput = null; $this->errorOutput = null;
$process = new Process($command, $cwd, null, null, static::getTimeout()); $process = new Process($command, $cwd, null, null, static::getTimeout());
if ($this->io && $this->io->isDebug()) {
$safeCommand = preg_replace('{(//[^:]+:)[^@]+}', '$1****', $command);
$this->io->write('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
}
$callback = is_callable($output) ? $output : array($this, 'outputHandler'); $callback = is_callable($output) ? $output : array($this, 'outputHandler');
$process->run($callback); $process->run($callback);