diff --git a/bash-preexec.sh b/bash-preexec.sh index 31aa937..13db194 100644 --- a/bash-preexec.sh +++ b/bash-preexec.sh @@ -11,7 +11,7 @@ # Author: Ryan Caloras (ryan@bashhub.com) # Forked from Original Author: Glyph Lefkowitz # -# V0.3.0 +# V0.3.1 # # General Usage: @@ -234,9 +234,17 @@ __bp_install() { # Adjust our HISTCONTROL Variable if needed. __bp_adjust_histcontrol - # Set so debug trap will work be invoked in subshells. - set -o functrace > /dev/null 2>&1 - shopt -s extdebug > /dev/null 2>&1 + + # Issue #25. Setting debug trap for subshells causes sessions to exit for + # backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash. + # + # This option allows you to disable subshells. + if [[ -z "$__bp_disable_subshells" ]]; then + + # Set so debug trap will work be invoked in subshells. + set -o functrace > /dev/null 2>&1 + shopt -s extdebug > /dev/null 2>&1 + fi; local existing_prompt_command