用PHP的Makefile的bash自动完成问题产生的目标 [英] Makefile bash autocompletion issue with PHP generated targets

查看:165
本文介绍了用PHP的Makefile的bash自动完成问题产生的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个很大的Makefile管理的项目,我最近增加了一些PHP生成的目标和bash完成停止工作:pressing [标签]不触发完成,但插入一个制表符。

In a large Makefile managed project, I recently added some PHP generated targets and bash completion stopped working: pressing [tab] does not trigger completion, but inserts a tab character.

我将问题这个简单的Makefile:

I isolated the issue to this minimal Makefile:

# TARGETS = $(echo target1 target2)
TARGETS = $(php -r 'echo "target1 target2";')
# TARGETS = $(python -c 'print "target1 target2"')
# TARGETS = $(ruby -e 'puts "target1 target2"')

$(TARGETS):
    echo $@

如果我使用的目标宏的bash的回声,Python或Ruby版本,bash补正常工作,但如果我使用的PHP版本的bash完成变得无用。

If I use the bash-echo, python or ruby version of the TARGETS macro, bash completion works as expected, but if I use the php version bash completion becomes useless.

我可以重现这个问题:


  • 的Mac OS 10.7.5使用默认的/ usr / bin中/ PHP(5.3.15),默认/斌/ bash的(3.2.48(1) - 释放),bash_completion 1.3_4(与MacPorts的安装)

  • 的Ubuntu 10.04默认的/ usr / bin中/ PHP(5.3.5-1ubuntu4ppa1),默认/斌/ bash的(4.1.5(1) - 释放),默认的bash-完成1:1.1-3ubuntu2

确实有人知道是怎么回事错的,什么,可不能做到?

does anybody knows what is going wrong and what can be done about it?

推荐答案

好吧,做了一些更多的研究和谷歌上搜索,发现了一个解释,一个解决方法为:

Ok, did some more researching and googling and found an explanation an workaround at:

  • Bash Completion Problems with option lists generated by PHP (May 2011; by Paul Serby)

显然,在PHP中的readline支持(PHP CLI与libedit对U​​buntu的清醒的ReadLine支持编译)导致该问题以某种方式(而不是由保罗Serby分析)和解决方法是明确采取的标准输入的控制PHP的过程。

Apparently the readline support in PHP (PHP CLI with libedit compiled in for readline support on Ubuntu Lucid) causes the issue in some way (not analyzed by Paul Serby) and the workaround is to explicitly take control of the standard input of the PHP process.

例如:

TARGETS = $(php -r 'echo "target1 target2";' < /dev/null )

TARGETS = $(echo '' | php -r 'echo "target1 target2";' )

这两种解决方案在两个平台我试工作。

both solutions work on both platforms I tried.

更多参考:

  • Bug #53040 PHP crash/failure when called from bash-completion (bugs.php.net; reported Oct 2010)

这篇关于用PHP的Makefile的bash自动完成问题产生的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆