vim-pad icon indicating copy to clipboard operation
vim-pad copied to clipboard

grep -P is not always available.

Open copiousfreetime opened this issue 9 years ago • 2 comments
trafficstars

The default search_ backend is effecively grep -P which is not available in all grep implementations. For instance many BSD's including OS X.

copiousfreetime avatar Dec 08 '15 07:12 copiousfreetime

Any ideas how to detect this without having to run and parse grep --version?

fmoralesc avatar Dec 08 '15 15:12 fmoralesc

I'd say check the exit status. If the exit status is >1 then there was an error.

% uname -s
Linux
% echo 'testing P' | grep -P test > /dev/null 2>&1
% echo $?
0
% uname -s
Darwin
% echo 'testing P' | grep -P test > /dev/null 2>&1
% echo $?
2

copiousfreetime avatar Dec 08 '15 17:12 copiousfreetime