-
Notifications
You must be signed in to change notification settings - Fork 45
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
hishtory changes exit code #247
Comments
Hmm, interesting. Can you share exactly how you have your prompt command configured? And what version of bash you're using? I tried to reproduce this using this example but it seems to be working fine for me. |
I tried to minimize example for reproducing the issue function prompt_comm()
{
local EXIT=${?};
PS1="\u\h:\w \t\n[${EXIT}] \$";
}
PROMPT_COMMAND="prompt_comm"
HISTCONTROL=ignoredups:ignorespace:erasedups
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar
export HISHTORY_SERVER=https://private.server
HISHTORY_SERVER=https://private.server
# Hishtory Config:
export PATH="$PATH:/home/grbit/.hishtory"
source $HOME/.hishtory/config.sh $HOME/.hishtory/config.sh is a copy of https://raw.githubusercontent.com/ddworken/hishtory/1c33189f38cca8e31e1e90923f39c7de4c06b4da/client/lib/config.sh |
Thank you for the time spent on this, I think I found something: export HISHTORY_SERVER=https://private.server
HISHTORY_SERVER=https://private.server
export PATH="$PATH:/home/grbit/.hishtory"
source $HOME/.hishtory/config.sh
function prompt_comm()
{
local EXIT=${?};
PS1="\u\h:\w \t\n[${EXIT}] \$";
}
PROMPT_COMMAND="prompt_comm"
HISTCONTROL=ignoredups:ignorespace:erasedups
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar Just moving hishtory source file before the moment I set PROMPT_COMMAND variable helps. I don't see this as an issue anymore, still I'm a bit curious to know the exact reason. So, unless you want to dig into bash a bit, the issue could be closed. UPDATE: |
Hi @ddworken!
I didn't notice it when I started to use your wonderful tool, but suddenly I realized that my command line prompt now always shows me
0
exit code.I have a
prompt_comm()
function that reads last command exit code and shows it, but now it looks like the last code is returned by hishtory command, so it's always 0.I'm not so good when it comes to bash scripts. Do you know if it would be easy to change hishtory bash script to make exit code of the command that was run available for the
prompt_comm()
funtiofunction?Here is how my command lie behaves without hishtory:
As you can see, the exit code shown right away.
Now with
.hishtory/config.sh
file:I thought I can change my prompt command, but it doesn't matter when I save exit code, in the beginning of the function, or at the end, it's always 0, unfortunately.
Thank you in advance for your time.
The text was updated successfully, but these errors were encountered: