Commit c7b9c45
committed
Prevent PHP process taking over stdin during completion on Centos 6
On a fresh install of Centos 6.7 with the default repositories bash and php-cli
packages installed (BASH 4.1.2, PHP 5.3.3), attempting to use completion after
registering it results in tab characters being added to stdin rather than the
expected completion results. The tab characters can be deleted with backspace,
however the input before pressing tab cannot - as if it's in another stream.
After a bit of fiddling, I've determined that the during the completion hook,
the PHP process running completion takes over or at least interferes with
stdin for the user's shell, causing the tab key presses to be rendered rather
than interpreted. This odd behaviour can be worked around by setting stdin
for the PHP process to something specific. I've used /dev/null here, though
I'm not 100% sure of its compatibility.
Simple test cases:
```bash
function _example_complete {
local cur=${COMP_WORDS[COMP_CWORD]}
local RESULT="apple banana cherry danger will robinson"
COMPREPLY=( $(compgen -W '$RESULT' -- $cur) )
};
function _example_complete {
php -r '' # run PHP and do nothing
local cur=${COMP_WORDS[COMP_CWORD]}
local RESULT="apple banana cherry danger will robinson"
COMPREPLY=( $(compgen -W '$RESULT' -- $cur) )
};
function _example_complete {
php -r '' </dev/null # run PHP and do nothing, specifying stdin as a file
local cur=${COMP_WORDS[COMP_CWORD]}
local RESULT="apple banana cherry danger will robinson"
COMPREPLY=( $(compgen -W '$RESULT' -- $cur) )
};
```
I haven't tested further to figure out if this is a problem with BASH or
with the PHP package on Centos 6, but since the issue doesn't occur under
ZSH, I suspect it's a problem with readline/BASH.
Fixes #571 parent 0e42611 commit c7b9c45
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments