@@ -131,6 +131,12 @@ private static function get_process_env_variables() {
131
131
if ( $ php_args = getenv ( 'WP_CLI_PHP_ARGS ' ) ) {
132
132
$ env ['WP_CLI_PHP_ARGS ' ] = $ php_args ;
133
133
}
134
+ if ( $ php_used = getenv ( 'WP_CLI_PHP_USED ' ) ) {
135
+ $ env ['WP_CLI_PHP_USED ' ] = $ php_used ;
136
+ }
137
+ if ( $ php = getenv ( 'WP_CLI_PHP ' ) ) {
138
+ $ env ['WP_CLI_PHP ' ] = $ php ;
139
+ }
134
140
if ( $ travis_build_dir = getenv ( 'TRAVIS_BUILD_DIR ' ) ) {
135
141
$ env ['TRAVIS_BUILD_DIR ' ] = $ travis_build_dir ;
136
142
}
@@ -526,7 +532,8 @@ public function background_proc( $cmd ) {
526
532
$ status = proc_get_status ( $ proc );
527
533
528
534
if ( !$ status ['running ' ] ) {
529
- throw new RuntimeException ( stream_get_contents ( $ pipes [2 ] ) );
535
+ $ stderr = is_resource ( $ pipes [2 ] ) ? ( ': ' . stream_get_contents ( $ pipes [2 ] ) ) : '' ;
536
+ throw new RuntimeException ( sprintf ( "Failed to start background process '%s'%s. " , $ cmd , $ stderr ) );
530
537
} else {
531
538
$ this ->running_procs [] = $ proc ;
532
539
}
@@ -617,7 +624,8 @@ public function install_wp( $subdir = '' ) {
617
624
'title ' => 'WP CLI Site ' ,
618
625
'admin_user ' => 'admin ' ,
619
626
'admin_email ' => 'admin@example.com ' ,
620
- 'admin_password ' => 'password1 '
627
+ 'admin_password ' => 'password1 ' ,
628
+ 'skip-email ' => true ,
621
629
);
622
630
623
631
$ install_cache_path = '' ;
@@ -658,7 +666,8 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ) {
658
666
'title ' => 'WP CLI Site with both WordPress and wp-cli as Composer dependencies ' ,
659
667
'admin_user ' => 'admin ' ,
660
668
'admin_email ' => 'admin@example.com ' ,
661
- 'admin_password ' => 'password1 '
669
+ 'admin_password ' => 'password1 ' ,
670
+ 'skip-email ' => true ,
662
671
);
663
672
664
673
$ this ->proc ( 'wp core install ' , $ install_args )->run_check ();
@@ -686,26 +695,13 @@ public function composer_require_current_wp_cli() {
686
695
$ this ->composer_command ( 'require wp-cli/wp-cli:dev-master --optimize-autoloader --no-interaction ' );
687
696
}
688
697
689
- public function get_php_binary () {
690
- if ( getenv ( 'WP_CLI_PHP_USED ' ) )
691
- return getenv ( 'WP_CLI_PHP_USED ' );
692
-
693
- if ( getenv ( 'WP_CLI_PHP ' ) )
694
- return getenv ( 'WP_CLI_PHP ' );
695
-
696
- if ( defined ( 'PHP_BINARY ' ) )
697
- return PHP_BINARY ;
698
-
699
- return 'php ' ;
700
- }
701
-
702
698
public function start_php_server ( $ subdir = '' ) {
703
699
$ dir = $ this ->variables ['RUN_DIR ' ] . '/ ' ;
704
700
if ( $ subdir ) {
705
701
$ dir .= trim ( $ subdir , '/ ' ) . '/ ' ;
706
702
}
707
703
$ cmd = Utils \esc_cmd ( '%s -S %s -t %s -c %s %s ' ,
708
- $ this -> get_php_binary (),
704
+ Utils \ get_php_binary (),
709
705
'localhost:8080 ' ,
710
706
$ dir ,
711
707
get_cfg_var ( 'cfg_file_path ' ),
0 commit comments