Skip to content

Commit

Permalink
Issue with Windows temp path fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed Murad Ali Shah authored and freekmurze committed Jul 3, 2024
1 parent b350ba1 commit 0686b84
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Browsershot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 0686b84

Please sign in to comment.