Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/process
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.0.2
Choose a base ref
...
head repository: symfony/process
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.0.3
Choose a head ref
  • 12 commits
  • 8 files changed
  • 4 contributors

Commits on Jan 11, 2024

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    9a2172b View commit details

Commits on Jan 12, 2024

  1. [Process] Fixed inconsistent test

    Sometimes the process no longer appears to be running when the signal is sent which causes a LogicException to be thrown.
    This doesn't appear to be consistent and I can reproduce it randomly on my local machine. To avoid having tests fail at random
    I decided that it's better to send the signal only if the process is still marked as running.
    amne committed Jan 12, 2024
    Copy the full SHA
    1759251 View commit details

Commits on Jan 17, 2024

  1. Merge branch '5.4' into 6.3

    * 5.4:
      [VarDumper] Fix missing colors initialization in CliDumper
      [Process] Fix executable finder when the command starts with a dash
      [Validator] added reviewed Lithuanian and Dutch translations
    xabbuh committed Jan 17, 2024
    Copy the full SHA
    8941334 View commit details
  2. Merge branch '6.3' into 6.4

    * 6.3:
      fix Redis proxies tests
      [VarDumper] Fix missing colors initialization in CliDumper
      [Process] Fix executable finder when the command starts with a dash
      [Validator] added reviewed Lithuanian and Dutch translations
      simplify the parser factory creation
    xabbuh committed Jan 17, 2024
    Copy the full SHA
    987e740 View commit details
  3. Merge branch '6.4' into 7.0

    * 6.4:
      fix Redis proxies tests
      [VarDumper] Fix missing colors initialization in CliDumper
      [Process] Fix executable finder when the command starts with a dash
      [Validator] added reviewed Lithuanian and Dutch translations
      simplify the parser factory creation
    xabbuh committed Jan 17, 2024
    Copy the full SHA
    31ce4a4 View commit details

Commits on Jan 19, 2024

  1. Merge branch '5.4' into 6.3

    * 5.4:
      [Console] Only execute additional checks for color support if the output is a TTY
      fix aircraft inflection
      [TwigBundle] Fix configuration when 'paths' is null
      [String] Correct inflection of axis
      [Security] Fix `AuthenticationUtils::getLastUsername()` returning null
      [Process] Fixed inconsistent test
    xabbuh committed Jan 19, 2024
    Copy the full SHA
    a7b4baa View commit details
  2. Merge branch '6.3' into 6.4

    * 6.3:
      [Console] Only execute additional checks for color support if the output is a TTY
      fix aircraft inflection
      [TwigBundle] Fix configuration when 'paths' is null
      register the MailPaceTransportFactory
      [String] Correct inflection of axis
      [Security] Fix `AuthenticationUtils::getLastUsername()` returning null
      [Process] Fixed inconsistent test
    xabbuh committed Jan 19, 2024
    Copy the full SHA
    d33b31f View commit details
  3. Merge branch '6.4' into 7.0

    * 6.4:
      fix used class after merge
      fix tests
      [Console] Only execute additional checks for color support if the output is a TTY
      fix aircraft inflection
      [TwigBundle] Fix configuration when 'paths' is null
      register the MailPaceTransportFactory
      [String] Correct inflection of axis
      [Security] Fix `AuthenticationUtils::getLastUsername()` returning null
      [Process] Fixed inconsistent test
    xabbuh committed Jan 19, 2024
    Copy the full SHA
    c9920b0 View commit details

Commits on Jan 23, 2024

  1. Copy the full SHA
    cbc28e3 View commit details
  2. Merge branch '5.4' into 6.3

    * 5.4:
      Fix implicitly-required parameters
      List CS fix in .git-blame-ignore-revs
      Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
      [Messenger][AmazonSqs] Allow async-aws/sqs version 2
    nicolas-grekas committed Jan 23, 2024
    Copy the full SHA
    6c5eceb View commit details
  3. Merge branch '6.3' into 6.4

    * 6.3:
      minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench)
      Fix bad merge
      List CS fix in .git-blame-ignore-revs
      Fix implicitly-required parameters
      List CS fix in .git-blame-ignore-revs
      Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
    nicolas-grekas committed Jan 23, 2024
    Copy the full SHA
    31642b0 View commit details
  4. Merge branch '6.4' into 7.0

    * 6.4:
      Fix implicitly-required parameters
      minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench)
      Fix bad merge
      List CS fix in .git-blame-ignore-revs
      Fix implicitly-required parameters
      List CS fix in .git-blame-ignore-revs
      Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
      [Messenger][AmazonSqs] Allow async-aws/sqs version 2
    nicolas-grekas committed Jan 23, 2024
    Copy the full SHA
    937a195 View commit details
Showing with 21 additions and 21 deletions.
  1. +1 −1 ExecutableFinder.php
  2. +1 −1 InputStream.php
  3. +1 −1 PhpExecutableFinder.php
  4. +3 −3 PhpProcess.php
  5. +3 −3 PhpSubprocess.php
  6. +9 −9 Process.php
  7. +1 −1 Tests/ErrorProcessInitiator.php
  8. +2 −2 Tests/ProcessTest.php
2 changes: 1 addition & 1 deletion ExecutableFinder.php
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public function addSuffix(string $suffix): void
* @param string|null $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*/
public function find(string $name, string $default = null, array $extraDirs = []): ?string
public function find(string $name, ?string $default = null, array $extraDirs = []): ?string
{
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
2 changes: 1 addition & 1 deletion InputStream.php
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ class InputStream implements \IteratorAggregate
/**
* Sets a callback that is called when the write buffer becomes empty.
*/
public function onEmpty(callable $onEmpty = null): void
public function onEmpty(?callable $onEmpty = null): void
{
$this->onEmpty = null !== $onEmpty ? $onEmpty(...) : null;
}
2 changes: 1 addition & 1 deletion PhpExecutableFinder.php
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ public function find(bool $includeArgs = true): string|false
{
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --';
if (\function_exists('exec') && $php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
if (!is_executable($php)) {
return false;
6 changes: 3 additions & 3 deletions PhpProcess.php
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ class PhpProcess extends Process
* @param int $timeout The timeout in seconds
* @param array|null $php Path to the PHP binary to use with any additional arguments
*/
public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
@@ -50,12 +50,12 @@ public function __construct(string $script, string $cwd = null, array $env = nul
parent::__construct($php, $cwd, $env, $script, $timeout);
}

public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
{
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}

public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
6 changes: 3 additions & 3 deletions PhpSubprocess.php
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ class PhpSubprocess extends Process
* @param int $timeout The timeout in seconds
* @param array|null $php Path to the PHP binary to use with any additional arguments
*/
public function __construct(array $command, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
public function __construct(array $command, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
@@ -73,12 +73,12 @@ public function __construct(array $command, string $cwd = null, array $env = nul
parent::__construct($command, $cwd, $env, null, $timeout);
}

public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
{
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}

public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
18 changes: 9 additions & 9 deletions Process.php
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ class Process implements \IteratorAggregate
*
* @throws LogicException When proc_open is not installed
*/
public function __construct(array $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60)
public function __construct(array $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60)
{
if (!\function_exists('proc_open')) {
throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
@@ -186,7 +186,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
*
* @throws LogicException When proc_open is not installed
*/
public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, mixed $input = null, ?float $timeout = 60): static
public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static
{
$process = new static([], $cwd, $env, $input, $timeout);
$process->commandline = $command;
@@ -241,7 +241,7 @@ public function __clone()
*
* @final
*/
public function run(callable $callback = null, array $env = []): int
public function run(?callable $callback = null, array $env = []): int
{
$this->start($callback, $env);

@@ -260,7 +260,7 @@ public function run(callable $callback = null, array $env = []): int
*
* @final
*/
public function mustRun(callable $callback = null, array $env = []): static
public function mustRun(?callable $callback = null, array $env = []): static
{
if (0 !== $this->run($callback, $env)) {
throw new ProcessFailedException($this);
@@ -288,7 +288,7 @@ public function mustRun(callable $callback = null, array $env = []): static
* @throws RuntimeException When process is already running
* @throws LogicException In case a callback is provided and output has been disabled
*/
public function start(callable $callback = null, array $env = []): void
public function start(?callable $callback = null, array $env = []): void
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
@@ -373,7 +373,7 @@ public function start(callable $callback = null, array $env = []): void
*
* @final
*/
public function restart(callable $callback = null, array $env = []): static
public function restart(?callable $callback = null, array $env = []): static
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
@@ -400,7 +400,7 @@ public function restart(callable $callback = null, array $env = []): static
* @throws ProcessSignaledException When process stopped after receiving signal
* @throws LogicException When process is not yet started
*/
public function wait(callable $callback = null): int
public function wait(?callable $callback = null): int
{
$this->requireProcessIsStarted(__FUNCTION__);

@@ -873,7 +873,7 @@ public function getStatus(): string
*
* @return int|null The exit-code of the process or null if it's not running
*/
public function stop(float $timeout = 10, int $signal = null): ?int
public function stop(float $timeout = 10, ?int $signal = null): ?int
{
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
@@ -1247,7 +1247,7 @@ private function getDescriptors(bool $hasCallback): array
*
* @param callable|null $callback The user defined PHP callback
*/
protected function buildCallback(callable $callback = null): \Closure
protected function buildCallback(?callable $callback = null): \Closure
{
if ($this->outputDisabled) {
return fn ($type, $data): bool => null !== $callback && $callback($type, $data);
2 changes: 1 addition & 1 deletion Tests/ErrorProcessInitiator.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
while (!str_contains($process->getOutput(), 'ready')) {
usleep(1000);
}
$process->signal(\SIGSTOP);
$process->isRunning() && $process->signal(\SIGSTOP);
$process->wait();

return $process->getExitCode();
4 changes: 2 additions & 2 deletions Tests/ProcessTest.php
Original file line number Diff line number Diff line change
@@ -1566,7 +1566,7 @@ public function testNotTerminableInputPipe()
$this->assertFalse($process->isRunning());
}

private function getProcess(string|array $commandline, string $cwd = null, array $env = null, mixed $input = null, ?int $timeout = 60): Process
private function getProcess(string|array $commandline, ?string $cwd = null, ?array $env = null, mixed $input = null, ?int $timeout = 60): Process
{
if (\is_string($commandline)) {
$process = Process::fromShellCommandline($commandline, $cwd, $env, $input, $timeout);
@@ -1579,7 +1579,7 @@ private function getProcess(string|array $commandline, string $cwd = null, array
return self::$process = $process;
}

private function getProcessForCode(string $code, string $cwd = null, array $env = null, $input = null, ?int $timeout = 60): Process
private function getProcessForCode(string $code, ?string $cwd = null, ?array $env = null, $input = null, ?int $timeout = 60): Process
{
return $this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout);
}