Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

fix: There may be no PHP_EOL in the Windows #9

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/Server/Transport/Stdio/SymfonyConsoleTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ public function isConnected(): bool

public function receive(): \Generator
{
$stream = $this->input instanceof StreamableInputInterface ? $this->input->getStream() : STDIN;
$line = fgets($stream ?? STDIN);

$stream = $this->input instanceof StreamableInputInterface ? $this->input->getStream() ?? STDIN : STDIN;
$line = fgets($stream);
if (false === $line) {
return;
}

$this->buffer .= $line;
$this->buffer .= STDIN === $stream ? rtrim($line).PHP_EOL : $line;
if (str_contains($this->buffer, PHP_EOL)) {
$lines = explode(PHP_EOL, $this->buffer);
$this->buffer = array_pop($lines);
Expand Down
Loading