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

Breadcrumb

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

function Process::buildShellCommandline

3 calls to Process::buildShellCommandline()
Process::getCommandLine in vendor/symfony/process/Process.php
Gets the command line to be executed.
Process::prepareWindowsCommandLine in vendor/symfony/process/Process.php
Process::start in vendor/symfony/process/Process.php
Starts the process and returns after writing the input to STDIN.

File

vendor/symfony/process/Process.php, line 1541

Class

Process
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.

Namespace

Symfony\Component\Process

Code

private function buildShellCommandline(string|array $commandline) : string {
    if (\is_string($commandline)) {
        return $commandline;
    }
    if ('\\' === \DIRECTORY_SEPARATOR && isset($commandline[0][0]) && \strlen($commandline[0]) === strcspn($commandline[0], ':/\\')) {
        // On Windows, we don't rely on the OS to find the executable if possible to avoid lookups
        // in the current directory which could be untrusted. Instead we use the ExecutableFinder.
        $commandline[0] = (self::$executables[$commandline[0]] ??= (new ExecutableFinder())->find($commandline[0])) ?? $commandline[0];
    }
    return implode(' ', array_map($this->escapeArgument(...), $commandline));
}
RSS feed
Powered by Drupal