Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4: (28 commits)
  [Serializer] Fix `@method` annotation
  fix compatibility with Doctrine DBAL 4
  ensure string type with mbstring func overloading enabled
  [HttpKernel] Fix quotes expectations in tests
  [Validator] updated Greek translation
  [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL
  [HttpClient][WebProfilerBundle] Do not generate cURL command when files are uploaded
  render newline in front of all script elements
  fix test fixture
  fix tests
  [Cache] Fix property types in PdoAdapter
  PHP files cannot be executable without shebang
  [TwigBridge] Mark CodeExtension as @internal
  Remove full DSNs from exception messages
  [Yaml] Fix uid binary parsing
  Disable the "Copy as cURL" button when the debug info are disabled
  [HttpClient] Replace `escapeshellarg` to prevent overpassing `ARG_MAX`
  Fix missing `profile` option for console commands
  [HttpFoundation][Lock] Makes MongoDB adapters usable with `ext-mongodb` only
  [HttpKernel] Preventing error 500 when function putenv is disabled
  ...
  • Loading branch information
nicolas-grekas committed Nov 7, 2023
2 parents 3411cf9 + a91571f commit 5610dee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Messenger/RunProcessContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
/**
* @author Kevin Bond <[email protected]>
*/
final class RunProcessContext extends RunProcessMessage
final class RunProcessContext
{
public readonly ?int $exitCode;
public readonly ?string $output;
public readonly ?string $errorOutput;

public function __construct(RunProcessMessage $message, Process $process)
{
parent::__construct($message->command, $message->cwd, $message->env, $message->input, $message->timeout);

public function __construct(
public readonly RunProcessMessage $message,
Process $process,
) {
$this->exitCode = $process->getExitCode();
$this->output = $process->isOutputDisabled() ? null : $process->getOutput();
$this->errorOutput = $process->isOutputDisabled() ? null : $process->getErrorOutput();
Expand Down
4 changes: 1 addition & 3 deletions Process.php
Original file line number Diff line number Diff line change
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 @@ -320,7 +318,7 @@ public function start(callable $callback = null, array $env = []): void

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
4 changes: 2 additions & 2 deletions Tests/Messenger/RunProcessMessageHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testRunSuccessfulProcess()
{
$context = (new RunProcessMessageHandler())(new RunProcessMessage(['ls'], cwd: __DIR__));

$this->assertSame(['ls'], $context->command);
$this->assertSame(['ls'], $context->message->command);
$this->assertSame(0, $context->exitCode);
$this->assertStringContainsString(basename(__FILE__), $context->output);
}
Expand All @@ -32,7 +32,7 @@ public function testRunFailedProcess()
try {
(new RunProcessMessageHandler())(new RunProcessMessage(['invalid']));
} catch (RunProcessFailedException $e) {
$this->assertSame(['invalid'], $e->context->command);
$this->assertSame(['invalid'], $e->context->message->command);
$this->assertSame('\\' === \DIRECTORY_SEPARATOR ? 1 : 127, $e->context->exitCode);

return;
Expand Down
Empty file modified Tests/OutputMemoryLimitProcess.php
100755 → 100644
Empty file.

0 comments on commit 5610dee

Please sign in to comment.