-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Preserve existing DEBUG traps #39
Comments
Similar support for |
the original We could also move it to the precmd_functions array as well. |
Ah, nice. Moving it to |
I'm actually not sure this is true; I found that sourced scripts can't override an existing DEBUG trap. Worse, it seems from within the sourced script there's no way to tell whether a DEBUG trap was already set or not. I'm not sure if this FR is possible. |
@dimo414 I noticed this a little while back. The debug trap isn't actually set when sourcing the script. bash-preexec actually does a two part install where it hooks its install function first into Original commit for it: 4744d7e |
Well that's clever :) It would not have crossed my mind to try that. In that case it seems like it should be possible to add the trap to
There's probably a better way to extract the DEBUG command, but that worked in a pinch. I take it you're open to a pull request adding something along these lines? |
Of course! Please feel free to submit a PR 👍 |
Closing addressed by @dimo414 |
@dimo414 Realized this PR no longer preserves the second half of a user's Lines 306 to 311 in f527a32
Any way that we can preserve any commands afterwards into precmd? e.g. a
would preserve both I was originally doing this by parsing out the entire install string and then putting the original prompt command back into PROMPT_COMMAND: |
- Relaxes requirement that bash-prexec.sh needs to be included as last thing in bash_profile.sh - Preserves existing prompt command in PROMPT_COMMAND variable. May make sense to still move this to a function in precmd. - Should address #97 and #39 - Keeps existing traps preserved as preexec functions - Removes trailing \n on PROMPT_COMMAND added for #58.
- Relaxes requirement that bash-prexec.sh needs to be included as last thing in bash_profile.sh - Preserves existing prompt command in PROMPT_COMMAND variable. May make sense to still move this to a function in precmd. - Should address #97 and #39 - Keeps existing traps preserved as preexec functions - Removes trailing \n on PROMPT_COMMAND added for #58.
Trap is preserved and prompt command is fixed in 0.4.0. |
Currently bash-preexec clobbers existing DEBUG traps when it is sourced. Would you be interested in a PR that moves the contents of
trap -p DEBUG
into a function and appends it topreexec_functions
?The text was updated successfully, but these errors were encountered: