Skip to content

Commit 0dc6539

Browse files
[1.x] Fixes Octane's process output not being flushed (#428)
* Fixes issue where `php://temp` may be full * Update InteractsWithServers.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 56c357d commit 0dc6539

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/Commands/Concerns/InteractsWithServers.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ protected function writeServerRunningMessage()
106106
]);
107107
}
108108

109+
/**
110+
* Retrieve the given server output and flush it.
111+
*
112+
* @return array
113+
*/
114+
protected function getServerOutput($server)
115+
{
116+
return tap([
117+
$server->getIncrementalOutput(),
118+
$server->getIncrementalErrorOutput(),
119+
], fn () => $server->clearOutput()->clearErrorOutput());
120+
}
121+
109122
/**
110123
* Returns the list of signals to subscribe.
111124
*

src/Commands/StartRoadRunnerCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ protected function rpcPort()
182182
*/
183183
protected function writeServerOutput($server)
184184
{
185-
Str::of($server->getIncrementalOutput())
185+
[$output, $errorOutput] = $this->getServerOutput($server);
186+
187+
Str::of($output)
186188
->explode("\n")
187189
->filter()
188190
->each(function ($output) {
@@ -210,7 +212,7 @@ protected function writeServerOutput($server)
210212
}
211213
});
212214

213-
Str::of($server->getIncrementalErrorOutput())
215+
Str::of($errorOutput)
214216
->explode("\n")
215217
->filter()
216218
->each(function ($output) {

src/Commands/StartSwooleCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,17 @@ protected function taskWorkerCount(SwooleExtension $extension)
170170
*/
171171
protected function writeServerOutput($server)
172172
{
173-
Str::of($server->getIncrementalOutput())
173+
[$output, $errorOutput] = $this->getServerOutput($server);
174+
175+
Str::of($output)
174176
->explode("\n")
175177
->filter()
176178
->each(fn ($output) => is_array($stream = json_decode($output, true))
177179
? $this->handleStream($stream)
178180
: $this->info($output)
179181
);
180182

181-
Str::of($server->getIncrementalErrorOutput())
183+
Str::of($errorOutput)
182184
->explode("\n")
183185
->filter()
184186
->groupBy(fn ($output) => $output)

0 commit comments

Comments
 (0)