Open trinitronx opened 6 years ago
Ah, I see why it's being used in this case... it's this: alias make='colourify make'
FYI: I have validated that this behavior has something to do with the -es
flags defined in the alias colourify="$GRC -es --colour=auto"
Editing the grc.bashrc
file and taking these out for the make
alias seems to fix the output from read
:
vi $(brew --prefix)/etc/grc.bashrc
:
Edits made:
GRC="$(which grc)"
if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias colourify="$GRC -es --colour=auto"
# [...SNIP...]
# BEGIN EDIT
# alias make='colourify make'
alias colorspecial='$GRC --colour=auto'
alias make='colorspecial make'
# END EDIT
# [...SNIP...]
I have a hunch that this was related to pipe buffering, and could possibly be mitigated by stdbuf
. Although it's untested on macOS, and I don't have the same system and particular Makefile
setup from years ago to reproduce.
When using the
read -r -p "some prompt here: "
bash builtin and havinggrc
loaded into the shell, it appears that the prompt is never displayed. This can cause confusion with things that spawn sub-shells such asmake
, and probably some bash scripts (maybe other tools too).Here is a
Makefile
to reproduce the issueTo reproduce:
grc
into~/.bashrc
brew install grc
, then add the following to~/.bashrc
:source "$(brew --prefix)/etc/grc.bashrc"
bash
shell & cd to the directory with thisMakefile
make test
read
(as theMakefile
is written to do)read
was actually expecting input, which you were unaware ofThen, try commenting out the
source
line which loadsgrc
into the shell. Retry the samemake test
and see the prompt is shown.I'm stumped as to why loading
grc
is affecting shell builtins in this way... the entire contents of the file under$(brew --prefix)/etc/grc.bashrc
only hasalias
definitions:I've tested this with:
bash --version
=GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin15.6.0)
make --version
=GNU Make 3.81
grc --version
=Generic Colouriser 1.11.1
(from Homebrew)And it also appears to affect the default shell
/bin/sh
on mac as well:/bin/sh --version
=GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
make --version
=GNU Make 3.81
grc --version
=Generic Colouriser 1.11.1
(from Homebrew)