I'm using Symfony/Process to run a test from Laravel Dusk in a route of web.php in Laravel. This is the code that I'm using:
Route::get('/scraping', function () {
$process = new Process('cd pathtoartisan && C:\xampp\php\php.exe artisan dusk -v');
$process->setPTY(true);
$process->run();
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo '<pre>'.$process->getOutput();
});
I think it would work fine, but I got this error:
Symfony\Component\Process\Exception\RuntimeException : A temporary file could not be opened to write the process output: fopen(C:\WINDOWS\sf_proc_00.out.lock): failed to open stream: Permission denied
at C:...\laravel-master\vendor\symfony\process\Pipes\WindowsPipes.php:60
> $file = sprintf('%s\\sf_proc_%02X.%s',$tmpDir, $i, $name);
> if (!$h = fopen($file.'.lock', 'w')) {
> restore_error_handler();
> throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError)); }
I have read in Symfony documentation that the following command should help me:
chmod -R 777 var/log/
But I'm using Windows and I don't know how to get that, also I don't know if it's correct that command, or if I should give permission to other file.