Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions features/shell.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
swissspidy marked this conversation as resolved.
Outdated

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.
"""
Comment thread
swissspidy marked this conversation as resolved.
Outdated

Scenario: Input starting with dash
Given a WP install
And a session file:
Expand Down
2 changes: 2 additions & 0 deletions src/WP_CLI/Shell/REPL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Comment thread
swissspidy marked this conversation as resolved.
}
Comment thread
swissspidy marked this conversation as resolved.
Expand Down