djui / alias-tips

An oh-my-zsh plugin to help remembering those aliases you defined once
781 stars 51 forks source link

grep: (standard input): binary file matches #56

Closed jeffreytse closed 3 years ago

jeffreytse commented 3 years ago

When the function has special characters, this plugin will show up this error information output by grep, this error was shown on every executed command, here is the key code line caused the error, it could be easily reproduced by using zsh-vi-mode at the same time.

image

image

jeffreytse commented 3 years ago

Issue: jeffreytse/zsh-vi-mode#97

djui commented 3 years ago

Thanks @jeffreytse I can merge this right away, just want to understand what’s happening:

How is it possible that egrep sees piped data from functions as binary? Does the zsh-vi-mode overload functions? None of the functions declared in the plug-in seem have non-ascii characters.

min addition to your silencing patch, maybe it’s a good idea to enforce egrep to expect only non-binary content: egrep -a?

jeffreytse commented 3 years ago

Hi @djui I think the functions will output all the functions, but in case the implementation of some functions would include some special characters, such as some control characters, it would cause the output looks like binary file for egrep.

jeffreytse commented 3 years ago

Hi @djui , zsh-vi-mode does nothing about the functions or grep, you could have a further test on the zsh-vi-mode plugin. I think we should redirect the error output of grep to /dev/null when we use subshell to capture the std output.