@@ -131,6 +131,12 @@ private static function get_process_env_variables() {
131131 if ( $ php_args = getenv ( 'WP_CLI_PHP_ARGS ' ) ) {
132132 $ env ['WP_CLI_PHP_ARGS ' ] = $ php_args ;
133133 }
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+ }
134140 if ( $ travis_build_dir = getenv ( 'TRAVIS_BUILD_DIR ' ) ) {
135141 $ env ['TRAVIS_BUILD_DIR ' ] = $ travis_build_dir ;
136142 }
@@ -526,7 +532,8 @@ public function background_proc( $cmd ) {
526532 $ status = proc_get_status ( $ proc );
527533
528534 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 ) );
530537 } else {
531538 $ this ->running_procs [] = $ proc ;
532539 }
@@ -617,7 +624,8 @@ public function install_wp( $subdir = '' ) {
617624 'title ' => 'WP CLI Site ' ,
618625 'admin_user ' => 'admin ' ,
619626 'admin_email ' =>
'[email protected] ' ,
620- 'admin_password ' => 'password1 '
627+ 'admin_password ' => 'password1 ' ,
628+ 'skip-email ' => true ,
621629 );
622630
623631 $ install_cache_path = '' ;
@@ -658,7 +666,8 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ) {
658666 'title ' => 'WP CLI Site with both WordPress and wp-cli as Composer dependencies ' ,
659667 'admin_user ' => 'admin ' ,
660668 'admin_email ' =>
'[email protected] ' ,
661- 'admin_password ' => 'password1 '
669+ 'admin_password ' => 'password1 ' ,
670+ 'skip-email ' => true ,
662671 );
663672
664673 $ this ->proc ( 'wp core install ' , $ install_args )->run_check ();
@@ -686,26 +695,13 @@ public function composer_require_current_wp_cli() {
686695 $ this ->composer_command ( 'require wp-cli/wp-cli:dev-master --optimize-autoloader --no-interaction ' );
687696 }
688697
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-
702698 public function start_php_server ( $ subdir = '' ) {
703699 $ dir = $ this ->variables ['RUN_DIR ' ] . '/ ' ;
704700 if ( $ subdir ) {
705701 $ dir .= trim ( $ subdir , '/ ' ) . '/ ' ;
706702 }
707703 $ cmd = Utils \esc_cmd ( '%s -S %s -t %s -c %s %s ' ,
708- $ this -> get_php_binary (),
704+ Utils \ get_php_binary (),
709705 'localhost:8080 ' ,
710706 $ dir ,
711707 get_cfg_var ( 'cfg_file_path ' ),
0 commit comments