From c1943192ce6efbab7b4d3f843319dc5fce52d5aa Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sun, 30 Jan 2022 11:37:18 -0800 Subject: [PATCH] lib/preexec: clarify subshell guard and comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrite comment on disabling the `DEBUG` trap in subshells, which is now handled upstream as of rcaloras/bash-preexec#26. Alsö, fix the guard variable assignment to allow it to be overridden elsewhere (e.g., for testing). --- lib/preexec.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/preexec.bash b/lib/preexec.bash index d1367d0b..8eba0e24 100644 --- a/lib/preexec.bash +++ b/lib/preexec.bash @@ -17,8 +17,9 @@ function __bp_adjust_histcontrol() { :; } # Don't fail on readonly variables function __bp_require_not_readonly() { :; } -# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040 -__bp_enable_subshells= # blank +# For performance, testing, and to avoid unexpected behavior: disable DEBUG traps in subshells. +# See bash-it/bash-it#1040 and rcaloras/bash-preexec#26 +: "${__bp_enable_subshells:=}" # blank # Modify `$PROMPT_COMMAND` in finalize hook _bash_it_library_finalize_hook+=('__bp_install_after_session_init')