From adf565360cc2fb844d965fd9195b363626e400d8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 19:30:29 +0000 Subject: [PATCH 1/3] Initial plan From 2071c56b453a10f0e832b9a4359378d33af4c4b7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 19:33:01 +0000 Subject: [PATCH 2/3] Use SHELL environment variable as fallback before /bin/bash Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/shell.feature | 22 ++++++++++++++++++++++ src/WP_CLI/Shell/REPL.php | 2 ++ 2 files changed, 24 insertions(+) diff --git a/features/shell.feature b/features/shell.feature index d5595506..bcaeaa18 100644 --- a/features/shell.feature +++ b/features/shell.feature @@ -61,6 +61,28 @@ Feature: WordPress REPL """ And STDERR should be empty + Scenario: Use SHELL environment variable as fallback + Given a WP install + + And a session file: + """ + return true; + """ + + When I try `SHELL=/bin/bash wp shell --basic < session` + Then STDOUT should contain: + """ + bool(true) + """ + And STDERR should be empty + + When I try `SHELL=/nonsense/path wp shell --basic < session` + Then STDOUT should be empty + And STDERR should contain: + """ + Error: The shell binary '/nonsense/path' is not valid. + """ + Scenario: Input starting with dash Given a WP install And a session file: diff --git a/src/WP_CLI/Shell/REPL.php b/src/WP_CLI/Shell/REPL.php index 99b8f1f8..d39bee91 100644 --- a/src/WP_CLI/Shell/REPL.php +++ b/src/WP_CLI/Shell/REPL.php @@ -122,6 +122,8 @@ private static function create_prompt_cmd( $prompt, $history_path ) { $history_path = escapeshellarg( $history_path ); if ( getenv( 'WP_CLI_CUSTOM_SHELL' ) ) { $shell_binary = getenv( 'WP_CLI_CUSTOM_SHELL' ); + } elseif ( getenv( 'SHELL' ) ) { + $shell_binary = getenv( 'SHELL' ); } else { $shell_binary = '/bin/bash'; } From 325dbde8c93194c6fa6034ba9e2aec4b984f8a8d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 2 Feb 2026 20:46:00 -0500 Subject: [PATCH 3/3] Update features/shell.feature Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- features/shell.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/shell.feature b/features/shell.feature index bcaeaa18..2974601f 100644 --- a/features/shell.feature +++ b/features/shell.feature @@ -77,11 +77,11 @@ Feature: WordPress REPL And STDERR should be empty When I try `SHELL=/nonsense/path wp shell --basic < session` - Then STDOUT should be empty - And STDERR should contain: + Then STDOUT should contain: """ - Error: The shell binary '/nonsense/path' is not valid. + bool(true) """ + And STDERR should be empty Scenario: Input starting with dash Given a WP install