mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix Platform.getOSArch for Windows
This commit is contained in:
parent
3d8345fd13
commit
737a39d4e1
1 changed files with 12 additions and 3 deletions
|
@ -61,15 +61,22 @@ public final class Platform {
|
||||||
if (unameOutput != null) {
|
if (unameOutput != null) {
|
||||||
arch= unameOutput;
|
arch= unameOutput;
|
||||||
}
|
}
|
||||||
|
bufferedReader.close();
|
||||||
unameProcess.waitFor(); // otherwise the process becomes a zombie
|
unameProcess.waitFor(); // otherwise the process becomes a zombie
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
} catch (InterruptedException exc) {
|
} catch (InterruptedException exc) {
|
||||||
Thread.currentThread().interrupt();
|
// clear interrupted state
|
||||||
|
Thread.interrupted();
|
||||||
}
|
}
|
||||||
} else if (arch.equals(org.eclipse.core.runtime.Platform.ARCH_X86)) {
|
} else if (arch.equals(org.eclipse.core.runtime.Platform.ARCH_X86)) {
|
||||||
// Determine if the platform is actually a x86_64 machine
|
// Determine if the platform is actually a x86_64 machine
|
||||||
Process unameProcess;
|
Process unameProcess;
|
||||||
String cmd[] = {"uname", "-p"}; //$NON-NLS-1$//$NON-NLS-2$
|
String cmd[];
|
||||||
|
if (org.eclipse.core.runtime.Platform.OS_WIN32.equals(getOS())) {
|
||||||
|
cmd = new String[] {"cmd", "/c", "set", "PROCESSOR_ARCHITECTURE"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
} else {
|
||||||
|
cmd = new String[] {"uname", "-p"}; //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unameProcess = Runtime.getRuntime().exec(cmd);
|
unameProcess = Runtime.getRuntime().exec(cmd);
|
||||||
|
@ -80,10 +87,12 @@ public final class Platform {
|
||||||
if (unameOutput != null && unameOutput.endsWith("64")) { //$NON-NLS-1$
|
if (unameOutput != null && unameOutput.endsWith("64")) { //$NON-NLS-1$
|
||||||
arch= org.eclipse.core.runtime.Platform.ARCH_X86_64;
|
arch= org.eclipse.core.runtime.Platform.ARCH_X86_64;
|
||||||
}
|
}
|
||||||
|
bufferedReader.close();
|
||||||
unameProcess.waitFor(); // otherwise the process becomes a zombie
|
unameProcess.waitFor(); // otherwise the process becomes a zombie
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
} catch (InterruptedException exc) {
|
} catch (InterruptedException exc) {
|
||||||
Thread.currentThread().interrupt();
|
// clear interrupted state
|
||||||
|
Thread.interrupted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cachedArch= arch;
|
cachedArch= arch;
|
||||||
|
|
Loading…
Add table
Reference in a new issue