Skip to content

Commit

Permalink
minor #52399 Remove unused code from Process (ausi)
Browse files Browse the repository at this point in the history
This PR was submitted for the 6.3 branch but it was merged into the 6.4 branch instead.

Discussion
----------

Remove unused code from Process

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

While trying to work on #43162 (comment) I noticed that the private member `useFileHandles` is not used for anything anymore.
It is always set in the constructor to `'\\' === \DIRECTORY_SEPARATOR` so it basically has a constant value and its only usage is in an `elseif` after a check to the very same constant value: `if ('\\' === \DIRECTORY_SEPARATOR)`.
Therefore this code does nothing and can be removed.

Commits
-------

7a5eba2 [Process] Remove dead code from Process
  • Loading branch information
nicolas-grekas committed Nov 1, 2023
2 parents 10209f5 + 7a5eba2 commit d7c5c47
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Symfony/Component/Process/Process.php
Expand Up @@ -77,7 +77,6 @@ class Process implements \IteratorAggregate
private bool $pty;
private array $options = ['suppress_errors' => true, 'bypass_shell' => true];

private bool $useFileHandles;
private WindowsPipes|UnixPipes $processPipes;

private ?int $latestSignal = null;
Expand Down Expand Up @@ -163,7 +162,6 @@ public function __construct(array $command, string $cwd = null, array $env = nul

$this->setInput($input);
$this->setTimeout($timeout);
$this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
$this->pty = false;
}

Expand Down Expand Up @@ -325,7 +323,7 @@ public function start(callable $callback = null, array $env = [])

if ('\\' === \DIRECTORY_SEPARATOR) {
$commandline = $this->prepareWindowsCommandLine($commandline, $env);
} elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
} elseif ($this->isSigchildEnabled()) {
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
$descriptors[3] = ['pipe', 'w'];

Expand Down

0 comments on commit d7c5c47

Please sign in to comment.