|
|
@@ -54,6 +54,25 @@ function supportsAvx2() {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
+ if (platform === "windows") {
|
|
|
+ const command =
|
|
|
+ '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
|
+ for (const executable of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
|
+ try {
|
|
|
+ const result = childProcess.spawnSync(executable, ["-NoProfile", "-NonInteractive", "-Command", command], {
|
|
|
+ encoding: "utf8",
|
|
|
+ timeout: 3000,
|
|
|
+ windowsHide: true,
|
|
|
+ })
|
|
|
+ if (result.status !== 0) continue
|
|
|
+ const output = (result.stdout || "").trim().toLowerCase()
|
|
|
+ if (output === "true" || output === "1") return true
|
|
|
+ if (output === "false" || output === "0") return false
|
|
|
+ } catch {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return false
|
|
|
}
|
|
|
|