List<WSLDistribution> () { if (!isWslExeSupported()) { //noinspection removal return WSLUtil.getAvailableDistributions(); } // we assume that after "2004" Windows release wsl.exe and all required flags are available if (Registry.is("wsl.list.prefer.verbose.output", true)) { try { final var result = loadInstalledDistributionsWithVersions(); return ContainerUtil.map(result, data -> { final WSLDistribution distribution = getOrCreateDistributionByMsId(data.getDistributionName(), true); distribution.setVersion(data.getVersion()); return distribution; }); } catch (IOException e) { LOG.warn(e); } catch (IllegalStateException e) { LOG.error(e); } } // fallback: using loadInstalledDistributionMsIds in case of execution exception or parsing error return ContainerUtil.map(loadInstalledDistributionMsIds(), (msId) -> { return getOrCreateDistributionByMsId(msId, true); }); }