Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 82be07f

Browse files
committed
fix: Env PATH fetch and find exec file not works in windows
1 parent b347e8c commit 82be07f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎src/Sys.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,19 @@ public static function getCpuNum(): int
248248
*/
249249
public static function findExecutable(string $name, array $paths = []): string
250250
{
251+
$isWin = self::isWindows();
251252
$paths = $paths ?: self::getEnvPaths();
252253

253254
foreach ($paths as $path) {
254255
$filename = $path . DIRECTORY_SEPARATOR . $name;
255256
if (is_file($filename)) {
256257
return $filename;
257258
}
259+
260+
// maybe is exe file
261+
if ($isWin && is_file($filename . '.exe')) {
262+
return $filename . '.exe';
263+
}
258264
}
259265
return "";
260266
}

‎src/SysEnv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function setEnv(string $key, int|string $value): bool
8080
*/
8181
public static function getEnvPaths(): array
8282
{
83-
$pathStr = $_SERVER['PATH'] ?? '';
83+
$pathStr = $_SERVER['PATH'] ?? ($_SERVER['Path'] ?? '');
8484
if (!$pathStr) {
8585
return [];
8686
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /