function ProcessExecutor::outputCommandRun
Parameters
string|list<string> $command:
2 calls to ProcessExecutor::outputCommandRun()
- ProcessExecutor::doExecute in vendor/
composer/ composer/ src/ Composer/ Util/ ProcessExecutor.php - ProcessExecutor::startJob in vendor/
composer/ composer/ src/ Composer/ Util/ ProcessExecutor.php
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ ProcessExecutor.php, line 473
Class
- ProcessExecutor
- @author Robert Schönthal <seroscho@googlemail.com> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\UtilCode
private function outputCommandRun($command, ?string $cwd, bool $async) : void {
if (null === $this->io || !$this->io
->isDebug()) {
return;
}
$commandString = is_string($command) ? $command : implode(' ', array_map(self::class . '::escape', $command));
$safeCommand = Preg::replaceCallback('{://(?P<user>[^:/\\s]+):(?P<password>[^@\\s/]+)@}i', static function ($m) : string {
// if the username looks like a long (12char+) hex string, or a modern github token (e.g. ghp_xxx) we obfuscate that
if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
return '://***:***@';
}
if (Preg::isMatch('{^[a-f0-9]{12,}$}', $m['user'])) {
return '://***:***@';
}
return '://' . $m['user'] . ':***@';
}, $commandString);
$safeCommand = Preg::replace("{--password (.*[^\\\\]\\') }", '--password \'***\' ', $safeCommand);
$this->io
->writeError('Executing' . ($async ? ' async' : '') . ' command (' . ($cwd ?: 'CWD') . '): ' . $safeCommand);
}