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

Breadcrumb

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

function Process::setOptions

Defines options to pass to the underlying proc_open().

Enabling the "create_new_console" option allows a subprocess to continue to run after the main process exited, on both Windows and *nix

See also

https://php.net/proc_open for the options supported by PHP.

File

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

Class

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

Namespace

Symfony\Component\Process

Code

public function setOptions(array $options) : void {
    if ($this->isRunning()) {
        throw new RuntimeException('Setting options while the process is running is not possible.');
    }
    $defaultOptions = $this->options;
    $existingOptions = [
        'blocking_pipes',
        'create_process_group',
        'create_new_console',
    ];
    foreach ($options as $key => $value) {
        if (!\in_array($key, $existingOptions)) {
            $this->options = $defaultOptions;
            throw new LogicException(\sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions)));
        }
        $this->options[$key] = $value;
    }
}
RSS feed
Powered by Drupal