Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ProcessExecutor.php

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\Util

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal