Skip to content

Commit e356077

Browse files
committed
Fixed STDER output error in some rare cases
1 parent c8a2c7a commit e356077

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Phpfastcache/Api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function getPhpfastcacheVersion(bool $fallbackOnChangelog = true,
7070
}
7171

7272
if (\function_exists('shell_exec')) {
73-
$command = 'git -C "' . __DIR__ . '" describe --abbrev=0 --tags';
73+
$command = 'git -C "' . __DIR__ . '" describe --abbrev=0 --tags ' . (DIRECTORY_SEPARATOR === '\\' ? '2>nul' : '2>/dev/null');
7474
$stdout = \shell_exec($command);
7575
if (\is_string($stdout)) {
7676
return trim($stdout);
@@ -133,7 +133,7 @@ public static function getPhpfastcacheGitHeadHash(bool $cacheable = true): strin
133133
}
134134

135135
if (\function_exists('shell_exec')) {
136-
$stdout = \shell_exec('git rev-parse --short HEAD');
136+
$stdout = \shell_exec('git rev-parse --short HEAD ' . (DIRECTORY_SEPARATOR === '\\' ? '2>nul' : '2>/dev/null'));
137137
if (\is_string($stdout)) {
138138
return '#' . \trim($stdout);
139139
}

0 commit comments

Comments
 (0)