CPP-744, CPP-6352: remote toolchain support; WSL: getWslVersion() was removed from WSLUtil

This commit is contained in:
Vasily Romanikhin
2017-10-25 16:04:02 +03:00
parent 5fe541d796
commit 981efcdddf
@@ -60,33 +60,8 @@ public class WSLUtil {
return StringUtil.isEmpty(localAppDataPath) ? null : localAppDataPath + WSL_ROOT_CHUNK;
});
private static final Pattern WIN_10_VERSION_PATTERN = Pattern.compile(".*(?:\\[Version 10\\.\\d+\\.(\\d+)\\])");
private static final int READ_VERSION_TIMEOUT = 10000;
private static final int RESOLVE_SYMLINK_TIMEOUT = 10000;
/**
* WSL version equals Windows build number
* (https://github.com/Microsoft/BashOnWindows/issues/1728)
*/
private static final AtomicNullableLazyValue<String> ourWSLVersion = AtomicNullableLazyValue.createValue(() -> {
final GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getWindowsShellName(), "/c", "ver");
try {
final ProcessOutput result = ExecUtil.execAndGetOutput(commandLine, READ_VERSION_TIMEOUT);
if (result.isTimeout()) return null;
final String out = result.getStdout().trim();
final Matcher matcher = WIN_10_VERSION_PATTERN.matcher(out);
if (matcher.find()) {
return matcher.group(1);
}
}
catch (ExecutionException e) {
LOG.warn(e);
}
return null;
});
/**
* @return bash file or null if not exists
*/
@@ -102,14 +77,6 @@ public class WSLUtil {
return getWSLBashFile() != null;
}
/**
* @return WSL build number or null if it cannot be determined
*/
@Nullable
public static String getWslVersion() {
return hasWSL() ? ourWSLVersion.getValue() : null;
}
/**
* @return Windows-dependent path for a file, pointed by {@code wslPath} in WSL
*/