Skip to content

Commit

Permalink
Merge pull request #41 from brandonweeks/append_prompt_command
Browse files Browse the repository at this point in the history
Remove trailing semicolon to allow appending to PROMPT_COMMANDS
  • Loading branch information
rcaloras authored May 9, 2017
2 parents 0c40174 + 64c6f53 commit 8141408
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bash-preexec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ __bp_install() {

# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
# actually entered something.
PROMPT_COMMAND="__bp_precmd_invoke_cmd; ${existing_prompt_command} __bp_interactive_mode;"
PROMPT_COMMAND="__bp_precmd_invoke_cmd; ${existing_prompt_command} __bp_interactive_mode"
eval "$__bp_trap_install_string"

# Add two functions to our arrays for convenience
Expand Down
8 changes: 8 additions & 0 deletions test/bash-preexec.bats
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ test_preexec_echo() {
[[ -z "$output" ]]
}

@test "\$PROMPT_COMMAND=\"\$PROMPT_COMMAND; foo\" should work" {
__bp_install

eval "$PROMPT_COMMAND=$PROMPT_COMMAND; true"

[[ -z "$output" ]]
}

@test "__bp_prompt_command_with_semi_colon should handle different PROMPT_COMMANDS" {
# PROMPT_COMMAND of spaces
PROMPT_COMMAND=" "
Expand Down

0 comments on commit 8141408

Please sign in to comment.