Home » Php » php – symfony2 application, vagrant & ant: stty: standard input: Invalid argument

php – symfony2 application, vagrant & ant: stty: standard input: Invalid argument

Posted by: admin July 12, 2020 Leave a comment


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. 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:

stty: standard input: Invalid argument

I could narrow the problem down to the following line of code, which executes the symfony cache:warmup command:

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.

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. 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.

How to&Answers:

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.
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:

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 -eand -q. I hope this helps one or another who struggles with an issue like this!