mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 10:25:36 +08:00
Add error handling for missing vswhere.exe in WindowsUtil
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace StaticPHP\Util\System;
|
namespace StaticPHP\Util\System;
|
||||||
|
|
||||||
|
use StaticPHP\Exception\EnvironmentException;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
class WindowsUtil
|
class WindowsUtil
|
||||||
@@ -47,6 +48,10 @@ class WindowsUtil
|
|||||||
|
|
||||||
// call vswhere (need VS and C++ tools installed), output is json
|
// call vswhere (need VS and C++ tools installed), output is json
|
||||||
$vswhere_exec = PKG_ROOT_PATH . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'vswhere.exe';
|
$vswhere_exec = PKG_ROOT_PATH . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'vswhere.exe';
|
||||||
|
// detect vswhere exists, if not throw error
|
||||||
|
if (!file_exists($vswhere_exec)) {
|
||||||
|
throw new EnvironmentException('vswhere.exe not found, please run `doctor` command first');
|
||||||
|
}
|
||||||
$args = [
|
$args = [
|
||||||
'-latest',
|
'-latest',
|
||||||
'-format', 'json',
|
'-format', 'json',
|
||||||
|
|||||||
Reference in New Issue
Block a user