Skip to content

Commit 070914b

Browse files
Merge pull request #1149 from DustinCampbell/fix-windows-arch-detection
Use environment variables to test bitness of Windows
2 parents a496cb2 + 120212f commit 070914b

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/platform.ts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,14 @@ export class PlatformInformation {
167167
}
168168

169169
private static GetWindowsArchitecture(): Promise<string> {
170-
return util.execChildProcess('wmic os get osarchitecture')
171-
.then(architecture => {
172-
if (architecture) {
173-
let archArray: string[] = architecture.split(os.EOL);
174-
if (archArray.length >= 2) {
175-
let arch = archArray[1].trim();
176-
177-
// Note: This string can be localized. So, we'll just check to see if it contains 32 or 64.
178-
if (arch.indexOf('64') >= 0) {
179-
return "x86_64";
180-
}
181-
else if (arch.indexOf('32') >= 0) {
182-
return "x86";
183-
}
184-
}
185-
}
186-
187-
return unknown;
188-
}).catch((error) => {
189-
return unknown;
190-
});
170+
return new Promise<string>((resolve, reject) => {
171+
if (process.env.PROCESSOR_ARCHITECTURE === 'x86' && process.env.PROCESSOR_ARCHITEW6432 === undefined) {
172+
resolve('x86');
173+
}
174+
else {
175+
resolve('x86_64');
176+
}
177+
});
191178
}
192179

193180
private static GetUnixArchitecture(): Promise<string> {

0 commit comments

Comments
 (0)