简体   繁体   English

symfony2应用程序,无业游民和蚂蚁:stty:标准输入:无效参数

[英]symfony2 application, vagrant & ant: stty: standard input: Invalid argument

I am trying to move my development environment (symfony2 application) from my windows 7 localhost to a virtual machine using vagrant and the default ubuntu 10.04 64 bit machine. 我正在尝试将我的开发环境(symfony2应用程序)从Windows 7本地主机移至使用vagrant和默认ubuntu 10.04 64位计算机的虚拟机。 Everything is set up and it almost works, but there is one thing bothering me: 一切都已设置好并且几乎可以正常工作,但是有一件事困扰着我:

When I run ant and it executes phpunit, I get the following error while executing my selfmade bootstrap: 当我运行ant并执行phpunit时,在执行自制引导程序时出现以下错误:

stty: standard input: Invalid argument

I could narrow the problem down to the following line of code, which executes the symfony cache:warmup command: 我可以将问题缩小到下面的代码行,该代码执行symfony cache:warmup命令:

executeCommand($application, "cache:warmup");

This executes the following command: 这将执行以下命令:

php app/console -e test -q cache:warmup

Running phpunit without ant works fine , so does running ant without the executeCommand line. 在没有ant的情况下运行phpunit可以正常工作 ,在没有executeCommand行的情况下运行ant也可以。

I read a bit about this stty error and looked up ~/.bashrc , ~./profile , /etc/bash.bashrc , /etc/profile as well as /root/.bashrc and /root/.profile without finding anything like tty or stty. 我读了一些关于这个stty的错误和抬头~/.bashrc~./profile/etc/bash.bashrc/etc/profile以及/root/.bashrc/root/.profile没有找到像什么tty或stty。 SO I don't know what I could delete to make it work. 因此,我不知道该删除什么才能使其正常工作。

I am a bit stuck as I need the cache warmup and cannot figure out what is going wrong. 我有点卡住了,因为我需要缓存预热并且无法弄清楚出了什么问题。

This took a while to figure out, but I now got it. 这花了一段时间才弄清楚,但我现在明白了。

For some reason, the options passed to the symfony2 application object causeing the issue only when run by ant. 由于某些原因,传递给symfony2应用程序对象的选项仅在由ant运行时才引起问题。 I don't have any insight on what causes it, but changing the command to this fixes the issue: 我对导致它的原因没有任何了解,但是将命令更改为此可以解决此问题:

php app/console --env=test --quiet cache:warmup

As this is only the long form and does not change anything, I'm very happy. 因为这只是长格式,不会改变任何内容,所以我很高兴。 My whole executeCommand function looks like this: 我的整个executeCommand函数如下所示:

function executeCommand($application, $command, Array $options = array()) {
    $options["--env"] = "test";
    $options["--quiet"] = true;
    $options = array_merge($options, array('command' => $command));

    $application->run(new ArrayInput($options));
}

The only lines changes are 2 and 3 where the key for the array was changed from -e and -q . 唯一的更改是2和3,其中数组的键已从-e-q更改。 I hope this helps one or another who struggles with an issue like this! 我希望这可以帮助一个或多个在这样的问题上挣扎的人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM