Closed aik099 closed 8 years ago
Under BASH 4.x on Debian with bash-completion 2.1, the message doesn't trigger for me during completion. With BASH 3.2 on OSX and bash-completion 1.3, the message is triggered by _get_comp_words_by_ref
in the shell hook. The unwanted output can be prevented by sending this function's output to /dev/null, or by unsetting the $MAILCHECK
environment variable at the start of the completion function and resetting it at the end.
- _get_comp_words_by_ref -n : cur;
+ _get_comp_words_by_ref -n : cur >/dev/null;
At a glance I'd say this is an issue with bash-completion rather than BASH, but I haven't actually dug into it to look yet.
# Occurs with other completions that use _get_comp_words_by_ref
$ git commYou have new mail in /var/mail/stecman
it
# Works fine for ones that don't
$ brew instal
instal install
If you want to debug this, you can set MAILCHECK=0
(= check after every command) and send yourself mail.
_get_comp_words_by_ref -n : cur >/dev/null;
Since cur
variable value is used in upcoming commands, then obviously that would break them.
If you want to debug this, you can set MAILCHECK=0 (= check after every command) and send yourself mail.
Yes, setting it to 0 at the beginning of hook (because we call several Bash functions in the middle) and restoring it's value at the end of hook seems like a desired solution. Hope that MAILCHECK is some kind of common name in all Bash/Unix version.
Yeah, the MAILCHECK
variable is documented in the BASH manual.
I tested the _get_comp_words_by_ref -n : cur >/dev/null;
change and it does work fine; the function doesn't output anything normally - it just takes the string arguments "-n", ":", and "cur".
Either solution works. Style-wise I prefer the piping to /dev/null with a comment since it's a bit tidier, but I suppose that could potentially hide other/real problems.. Style is up to you if you want to submit a PR for it, though.
Sure. I'll submit the PR then.
Sometimes I'm seeing
You have mail in /var/spool/mail/username_here
text injected in the middle of completion results which makes them unusable.This seems to be an output from some kind of system mail checker, but I'm unsure why it gets in the middle of completed results from bash.
For me it happened when I tried to auto-complete for paths and above message was injected at place where I placed TAB. But when I hit ENTER the proper command was executed.
Maybe that message (about mail) goes to STDERR and it's bash who is stupid enough to output it in the middle of auto-completion results.