0

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.

luchaninov
  • 6,792
  • 6
  • 60
  • 75
none32
  • 515
  • 1
  • 5
  • 21
  • Do you get anything different with any of the following statements: 1) `$process = new Process('dir', null, null, null, 60, ['suppress_errors' => false]);`? 2) `$process = new Process('dir', null, null, null, 60, ['suppress_errors' => false, 'bypass_shell' => false]);`? 3) `$process = new Process('dir'); $process->setEnhanceWindowsCompatibility(false);`? – patricus Feb 08 '15 at 22:39
  • @patricus Nothing helped. However, the last (3) method returned no output at all. – none32 Feb 09 '15 at 20:33

1 Answers1

1

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

$process->setEnhanceWindowsCompatibility(false);