1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 575159: Consider return code of wsl.exe

If the return code is non-zero wsl may have failed in someway, with
recent changes in Windows, wsl.exe is present even when wsl is not
installed. In that case wsl.exe is a dummy that can be used to install
wsl.

Change-Id: I83af60623084e1364d16c3a1739bc4f6a25ac3a9
This commit is contained in:
Jonah Graham 2021-08-24 12:39:15 -04:00
parent 390a8d22b5
commit 0cd0aa1270

View file

@ -144,6 +144,18 @@ public class DetectWSL implements IDetectExternalExecutable {
} }
} }
try {
// lets get the return code to make sure that the process did not produce anything unexpected. As the streams
// are closed, the waitFor shouldn't block.
if (process.waitFor() != 0) {
// WSL can send errors to stdout, so discard results if the exit value ends up being non-zero
result.clear();
}
} catch (InterruptedException e) {
// we've been interrupted, give up on the output we have (probably unreachable in practice)
result.clear();
}
} catch (IOException e) { } catch (IOException e) {
} }
} }