11<?php namespace xp \web \srv ;
22
3- use io \{Path , IOException };
3+ use io \{Path , OperationFailed };
44use lang \archive \ArchiveClassLoader ;
55use lang \{Runtime , RuntimeOptions , CommandLine , FileSystemClassLoader };
66use peer \Socket ;
@@ -43,7 +43,7 @@ public function __construct($docroot, $classLoaders) {
4343 /**
4444 * Launches a worker and returns it.
4545 *
46- * @throws io.IOException
46+ * @throws io.OperationFailed
4747 * @return xp.web.srv.Worker
4848 */
4949 public function launch () {
@@ -65,7 +65,7 @@ public function launch() {
6565 if ('WINDOWS ' !== $ os ->name ()) $ commandLine = 'exec ' .$ commandLine ;
6666
6767 if (!($ proc = proc_open ($ commandLine , [STDIN , STDOUT , ['pipe ' , 'w ' ]], $ pipes , null , null , ['bypass_shell ' => true ]))) {
68- throw new IOException ('Cannot execute ` ' .$ commandLine .'` ' );
68+ throw new OperationFailed ('Cannot execute ` ' .$ commandLine .'` ' );
6969 }
7070
7171 // Parse `[...] PHP 8.3.15 Development Server (http://127.0.0.1:60922) started`
@@ -78,7 +78,7 @@ public function launch() {
7878 if (!preg_match ('/\([a-z]+:\/\/([0-9.]+):([0-9]+)\)/ ' , $ line , $ matches )) {
7979 proc_terminate ($ proc , 2 );
8080 proc_close ($ proc );
81- throw new IOException ('Cannot determine bound port: ` ' .implode ('' , $ lines ).'` ' );
81+ throw new OperationFailed ('Cannot determine bound port: ` ' .implode ('' , $ lines ).'` ' );
8282 }
8383
8484 return new Worker ($ proc , new Socket ($ matches [1 ], (int )$ matches [2 ]));
0 commit comments