File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff 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 *
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments