-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't actually work at all #29
Comments
@Integralist thanks for opening. Could you provide a bit more debugging information after you've sourced bash-preexec.sh? # Contents of your prompt command
echo $PROMPT_COMMAND
# Contents of preexec
echo ${preexec_functions[@]}
# Contents of precmd
echo ${precmd_functions[@]}
# Trap should contain bash-preexec's hook
trap
# Check if it's imported
echo "$__bp_imported" Should return values like.. $ echo $PROMPT_COMMAND
__bp_precmd_invoke_cmd; __bp_interactive_mode;
$ echo ${preexec_functions[@]}
__bh_preexec preexec
$ echo ${precmd_functions[@]}
__bh_precmd_run_script __bh_bash_precmd __bh_precmd precmd
$ trap
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
trap -- '__bp_preexec_invoke_exec' DEBUG
$ echo $__bp_imported
defined Not sure about the homebrew installation, as I didn't create it or use it, but my guess is something is conflicting with your trap or PROMPT_COMMAND. |
Sure thing @rcaloras the details you've asked for are as follows...
$ echo $PROMPT_COMMAND
history -a
$ echo ${preexec_functions[@]}
preexec
$ echo ${precmd_functions[@]}
precmd
$ trap
trap -- 'shell_session_update' EXIT
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
trap -- '__bp_preexec_invoke_exec' DEBUG
$ echo "$__bp_imported"
defined |
So it looks like bash-preexec is getting pulled in correctly, but PROMPT_COMMAND is not right. If it's right, your PROMPT_COMMAND should have at least the two functions mine does: $ echo $PROMPT_COMMAND
__bp_precmd_invoke_cmd; __bp_interactive_mode; Looking at your ~/.bashrc, it looks like you're overwriting PROMPT_COMMAND in a few places. From your file: export PROMPT_COMMAND='history -a' # record each line as it gets issued
# override builtin cd so it resets command prompt when changing directories
function cd {
builtin cd "$@"
RET=$?
PROMPT_COMMAND=prompt
# Disabled following because it seems to be pointless now?
# That or I just don't know what it was really doing originally?
#
# # After each command, append to the history file and reread it...
# export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
return $RET
} One thing you could do is remove the overwriting of PROMPT_COMMAND and instead define whatever you want in PROMPT_COMMAND as part of a precmd function e.g. precmd() {
history -a
} Give it a shot. Let me know if there's anything else I can help with. |
Heya, so I've got this working now. Totally my bad. I sorted out my command prompt setup and it works fine 👍 Thanks for taking the time to look into this, you were right |
@Integralist no worries! Glad you got it working and I could help! Feel free to checkout some of my other projects as well, bash-preexec was designed to power https://bashhub.com. |
Here is my Bash version (installed via Homebrew):
Here is the bash location:
The text was updated successfully, but these errors were encountered: