File tree Expand file tree Collapse file tree 5 files changed +213
-74
lines changed Expand file tree Collapse file tree 5 files changed +213
-74
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " wp-cli/shell-command" ,
3- "description" : " Interactive PHP console." ,
3+ "description" : " Opens an interactive PHP console for running and testing PHP code ." ,
44 "type" : " wp-cli-package" ,
55 "homepage" : " https://github.com/wp-cli/shell-command" ,
66 "support" : {
Original file line number Diff line number Diff line change @@ -699,11 +699,15 @@ public function get_php_binary() {
699699 return 'php ' ;
700700 }
701701
702- public function start_php_server () {
702+ public function start_php_server ( $ subdir = '' ) {
703+ $ dir = $ this ->variables ['RUN_DIR ' ] . '/ ' ;
704+ if ( $ subdir ) {
705+ $ dir .= trim ( $ subdir , '/ ' ) . '/ ' ;
706+ }
703707 $ cmd = Utils \esc_cmd ( '%s -S %s -t %s -c %s %s ' ,
704708 $ this ->get_php_binary (),
705709 'localhost:8080 ' ,
706- $ this -> variables [ ' RUN_DIR ' ] . ' /wordpress/ ' ,
710+ $ dir ,
707711 get_cfg_var ( 'cfg_file_path ' ),
708712 $ this ->variables ['RUN_DIR ' ] . '/vendor/wp-cli/server-command/router.php '
709713 );
Original file line number Diff line number Diff line change @@ -87,15 +87,17 @@ public function run() {
8787 self ::$ run_times [ $ this ->command ][1 ]++;
8888 }
8989
90- return new ProcessRun ( array (
91- 'stdout ' => $ stdout ,
92- 'stderr ' => $ stderr ,
93- 'return_code ' => $ return_code ,
94- 'command ' => $ this ->command ,
95- 'cwd ' => $ this ->cwd ,
96- 'env ' => $ this ->env ,
97- 'run_time ' => $ run_time ,
98- ) );
90+ return new ProcessRun (
91+ array (
92+ 'stdout ' => $ stdout ,
93+ 'stderr ' => $ stderr ,
94+ 'return_code ' => $ return_code ,
95+ 'command ' => $ this ->command ,
96+ 'cwd ' => $ this ->cwd ,
97+ 'env ' => $ this ->env ,
98+ 'run_time ' => $ run_time ,
99+ )
100+ );
99101 }
100102
101103 /**
@@ -107,7 +109,7 @@ public function run_check() {
107109 $ r = $ this ->run ();
108110
109111 // $r->STDERR is incorrect, but kept incorrect for backwards-compat
110- if ( $ r ->return_code || !empty ( $ r ->STDERR ) ) {
112+ if ( $ r ->return_code || ! empty ( $ r ->STDERR ) ) {
111113 throw new \RuntimeException ( $ r );
112114 }
113115
You can’t perform that action at this time.
0 commit comments