@@ -128,7 +128,7 @@ private function init(): int
128128
129129 private function sourceList (): int
130130 {
131- $ sources = (new SourceService ($ this ->project ))->list ();
131+ $ sources = (new SourceService ($ this ->project , $ this -> sandboxOutput () ))->list ();
132132
133133 if (!$ sources )
134134 {
@@ -163,7 +163,7 @@ private function sourceRemove(array $args): int
163163 throw new InvalidArgumentException ('Usage: qi source:remove <version|source> [--force] ' );
164164 }
165165
166- $ removed = (new SourceService ($ this ->project ))->remove ($ version , $ cli ->has ('force ' ));
166+ $ removed = (new SourceService ($ this ->project , $ this -> sandboxOutput () ))->remove ($ version , $ cli ->has ('force ' ));
167167 echo "Removed source: {$ removed ['source ' ]['source_key ' ]}\n" ;
168168 if (!empty ($ removed ['used_by ' ]))
169169 {
@@ -175,7 +175,7 @@ private function sourceRemove(array $args): int
175175
176176 private function sourcePrune (): int
177177 {
178- $ removed = (new SourceService ($ this ->project ))->prune ();
178+ $ removed = (new SourceService ($ this ->project , $ this -> sandboxOutput () ))->prune ();
179179 if (!$ removed )
180180 {
181181 echo "No unused sources to prune \n" ;
@@ -199,7 +199,7 @@ private function sourceFetch(array $args): int
199199 throw new InvalidArgumentException ('Usage: qi source:fetch <version|branch> [--git] [--url URL] [--allow-external] ' );
200200 }
201201
202- $ record = (new SourceService ($ this ->project ))->fetch ($ version , $ cli ->has ('git ' ), $ cli ->option ('url ' ), $ cli ->has ('allow-external ' ));
202+ $ record = (new SourceService ($ this ->project , $ this -> sandboxOutput () ))->fetch ($ version , $ cli ->has ('git ' ), $ cli ->option ('url ' ), $ cli ->has ('allow-external ' ));
203203
204204 echo "Fetched phpBB source: {$ record ['path ' ]}\n" ;
205205 return 0 ;
@@ -217,7 +217,7 @@ private function phpbbList(): int
217217 $ row ['resolves_to ' ],
218218 $ row ['notes ' ],
219219 ];
220- }, (new SourceService ($ this ->project ))->supportedVersions ())
220+ }, (new SourceService ($ this ->project , $ this -> sandboxOutput () ))->supportedVersions ())
221221 );
222222
223223 return 0 ;
@@ -240,7 +240,7 @@ private function boardCreate(array $args): int
240240 $ debug = $ cli ->has ('debug ' );
241241 $ this ->validateBoardCreateOptions ($ db , $ port , $ populate );
242242
243- $ created = (new BoardService ($ this ->project ))->create ($ name , $ version , $ db , $ port , $ populate , $ debug , $ cli ->has ('replace ' ));
243+ $ created = (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->create ($ name , $ version , $ db , $ port , $ populate , $ debug , $ cli ->has ('replace ' ));
244244 $ paths = $ created ['paths ' ];
245245
246246 echo "Created board scaffold: $ name \n" ;
@@ -266,7 +266,7 @@ private function boardCreate(array $args): int
266266
267267 private function boardList (): int
268268 {
269- $ boards = (new BoardService ($ this ->project ))->list ();
269+ $ boards = (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->list ();
270270 if (!$ boards )
271271 {
272272 echo "No boards created \n" ;
@@ -408,7 +408,7 @@ private function supportsAnsi(): bool
408408 private function boardStart (array $ args ): int
409409 {
410410 $ name = $ this ->boardName ($ args , 'Usage: qi board:start <name> ' );
411- $ board = (new BoardService ($ this ->project ))->start ($ name );
411+ $ board = (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->start ($ name );
412412 echo "Started board: $ name \n" ;
413413 echo "URL: {$ board ['url ' ]}\n" ;
414414 return 0 ;
@@ -417,15 +417,15 @@ private function boardStart(array $args): int
417417 private function boardStop (array $ args ): int
418418 {
419419 $ name = $ this ->boardName ($ args , 'Usage: qi board:stop <name> ' );
420- (new BoardService ($ this ->project ))->stop ($ name );
420+ (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->stop ($ name );
421421 echo "Stopped board: $ name \n" ;
422422 return 0 ;
423423 }
424424
425425 private function boardDestroy (array $ args ): int
426426 {
427427 $ name = $ this ->boardName ($ args , 'Usage: qi board:destroy <name> ' );
428- (new BoardService ($ this ->project ))->destroy ($ name );
428+ (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->destroy ($ name );
429429 echo "Destroyed board: $ name \n" ;
430430 return 0 ;
431431 }
@@ -452,7 +452,7 @@ private function boardSeed(array $args): int
452452 }
453453 $ action = $ cli ->has ('reset ' ) ? 'reset ' : ($ cli ->has ('replace ' ) ? 'replace ' : 'seed ' );
454454
455- (new BoardService ($ this ->project ))->seed ($ name , $ preset , $ seed , $ action );
455+ (new BoardService ($ this ->project , $ this -> sandboxOutput () ))->seed ($ name , $ preset , $ seed , $ action );
456456 echo ucfirst ($ action ) . " completed for board: $ name \n" ;
457457 return 0 ;
458458 }
@@ -538,7 +538,7 @@ private function extUnmount(array $args): int
538538
539539 private function refreshBoardIfRunning (string $ board ): void
540540 {
541- $ runner = new BoardRunner ($ this ->project );
541+ $ runner = new BoardRunner ($ this ->project , $ this -> sandboxOutput () );
542542 (new DockerComposeWriter ($ this ->project ))->write ($ board , $ this ->runtimeConfig ($ this ->project ->board ($ board )));
543543 if ($ runner ->status ($ board ) === 'running ' )
544544 {
@@ -677,6 +677,12 @@ private function writeError(string $message): void
677677 fwrite ($ this ->stderr , $ message );
678678 }
679679
680+ private function sandboxOutput (): Output
681+ {
682+ $ stdout = defined ('STDOUT ' ) && defined ('STDERR ' ) && $ this ->stderr === STDERR ? STDOUT : fopen ('php://output ' , 'w ' );
683+ return new StreamOutput ($ stdout , $ this ->stderr );
684+ }
685+
680686 private function mountResources (string $ type , object $ manager , string $ board , string $ source , bool $ copy , bool $ recursive , bool $ allowExternal ): int
681687 {
682688 if ($ recursive )
0 commit comments