Search code examples
phpsymfonylaravellaravel-4symfony-process

Laravel\Symfony Process component fails to start new process


I'm using the Process component provided by Symfony in my Laravel project: http://symfony.com/doc/current/components/process.html.

Here is my code:

$process = new Process('dir');
try
{
    $process->mustRun();
    print $process->getOutput();
} catch (ProcessFailedException $e) {
    print $e->getMessage();
}

So, nothing fancy here, just a cookbook solution. However, I'm getting the following error:

The command "dir" failed.
Exit Code: 1(General error)

Output:
================



Error Output:
================

I cannot figure out what's the problem since there is nothing in logs. If it matters, I'm running it on Windows Server 2008 R2.


Solution

  • I had the same issue like @none32 faced. I tried below solution suggested by @patricus and it worked for me.

    $process->setEnhanceWindowsCompatibility(false);