Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions features/shell.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,20 @@ Feature: WordPress REPL
bool(true)
"""
And STDERR should be empty

Scenario: Input starting with dash
Given a WP install
And a session file:
"""
-1
"""

When I run `wp shell --basic < session`
Then STDOUT should contain:
"""
int(-1)
"""
And STDERR should not contain:
"""
history: -1: invalid option
"""
2 changes: 1 addition & 1 deletion src/WP_CLI/Shell/REPL.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private static function create_prompt_cmd( $prompt, $history_path ) {
. 'LINE=""; '
. "read -re -p {$prompt} LINE; "
. '[ $? -eq 0 ] || exit; '
. 'history -s "$LINE"; '
. 'history -s -- "$LINE"; '
. "history -w {$history_path}; "
. 'echo $LINE; ';

Expand Down
Loading