diff --git a/src/Browsershot.php b/src/Browsershot.php index 84fccbb..2293f7a 100644 --- a/src/Browsershot.php +++ b/src/Browsershot.php @@ -1031,7 +1031,7 @@ protected function callBrowser(array $command): string { $fullCommand = $this->getFullCommand($command); - $process = $this->isWindows() ? new Process($fullCommand) : Process::fromShellCommandline($fullCommand); + $process = $this->isWindows() ? new Process($fullCommand, null, $this->getWindowsEnv()) : Process::fromShellCommandline($fullCommand); $process->setTimeout($this->timeout); @@ -1064,6 +1064,16 @@ protected function callBrowser(array $command): string throw new ProcessFailedException($process); } + protected function getWindowsEnv() : array + { + return [ + "LOCALAPPDATA" => getenv("LOCALAPPDATA"), + "Path" => getenv("Path"), + "SystemRoot" => getenv("SystemRoot"), + "USERPROFILE" => getenv("USERPROFILE"), + ]; + } + protected function getFullCommand(array $command): array|string { $nodeBinary = $this->nodeBinary ?: 'node';