Changeset 13465 in josm for trunk


Ignore:
Timestamp:
2018-02-26T01:10:01+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #15992 - also make sure recent version of PowerShell is installed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r13463 r13465  
    717717
    718718    /**
     719     * Returns the major version number of PowerShell.
     720     * @return the major version number of PowerShell. -1 in case of error
     721     * @since 13465
     722     */
     723    public static int getPowerShellVersion() {
     724        try {
     725            return Integer.valueOf(Utils.execOutput(Arrays.asList("powershell", "-Command", "$PSVersionTable.PSVersion.Major")));
     726        } catch (NumberFormatException | IOException | ExecutionException | InterruptedException e) {
     727            Logging.error(e);
     728            return -1;
     729        }
     730    }
     731
     732    /**
    719733     * Performs a web request using Windows CryptoAPI (through PowerShell).
    720734     * This is useful to ensure Windows trust store will contain a specific root CA.
     
    728742        // Invoke-WebRequest -SSlProtocol Tsl12 $uri
    729743        // .NET framework < 4.5 does not support TLS 1.2 (https://stackoverflow.com/a/43240673/2257172)
    730         if (isDotNet45Installed()) {
     744        if (isDotNet45Installed() && getPowerShellVersion() >= 3) {
    731745            try {
    732746                // The following works with PS 3.0 (Windows 8+), https://stackoverflow.com/a/41618979/2257172
Note: See TracChangeset for help on using the changeset viewer.