Output VcsDownloader process commands in -vvv mode

main
Jordi Boggiano 11 years ago
parent 3fd883a489
commit 5cdf40d165

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

@ -13,6 +13,7 @@
namespace Composer\Util;
use Symfony\Component\Process\Process;
use Composer\IO\IOInterface;
/**
* @author Robert Schönthal <seroscho@googlemail.com>
@ -23,6 +24,12 @@ class ProcessExecutor
protected $captureOutput;
protected $errorOutput;
protected $io;
public function __construct(IOInterface $io = null)
{
$this->io = $io;
}
/**
* runs a process on the commandline
@ -39,6 +46,11 @@ class ProcessExecutor
$this->errorOutput = null;
$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');
$process->run($callback);

Loading…
Cancel
Save