@@ -40,26 +40,26 @@ Write-Host "Downloading Dev Proxy $version..."
40
40
$base_url = " https://github.com/microsoft/dev-proxy/releases/download/$version /dev-proxy"
41
41
42
42
# Check system architecture
43
- $os = $PSVersionTable .OS
43
+ # empty in Windows PowerShell
44
44
$arch = [System.Runtime.InteropServices.RuntimeInformation ]::OSArchitecture
45
+ # fallback for Windows PowerShell
46
+ $os = [System.Runtime.InteropServices.RuntimeInformation ]::OSDescription
47
+ $isX64 = [Environment ]::Is64BitOperatingSystem
45
48
46
49
if ($os -match " Windows" ) {
47
- if ($arch -eq " X64 " ) {
50
+ if ($isX64 ) {
48
51
$url = " $base_url -win-x64-$version .zip"
49
- } elseif ($arch -eq " X86" ) {
50
- $url = " $base_url -win-x86-$version .zip"
51
52
} else {
52
- Write-Host " Unsupported architecture $arch . Aborting"
53
- exit 1
53
+ $url = " $base_url -win-x86-$version .zip"
54
54
}
55
- } elseif ($os -match " Linux " ) {
55
+ } elseif ($IsLinux ) {
56
56
if ($arch -eq " X64" ) {
57
57
$url = " $base_url -linux-x64-$version .zip"
58
58
} else {
59
59
Write-Host " Unsupported architecture $arch . Aborting"
60
60
exit 1
61
61
}
62
- } elseif ($os -match " Darwin " ) {
62
+ } elseif ($IsMacOS ) {
63
63
# temporary workaround to install devproxy on Mx macs
64
64
if ($arch -eq " X64" -or $arch -eq " Arm64" ) {
65
65
$url = " $base_url -osx-x64-$version .zip"
@@ -77,7 +77,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
77
77
Expand-Archive - Path devproxy.zip - DestinationPath . - Force - ErrorAction Stop
78
78
Remove-Item devproxy.zip
79
79
80
- if ($os -match " Linux " - or $os -match " Darwin " ) {
80
+ if ($IsLinux - or $IsMacOS ) {
81
81
Write-Host " Configuring devproxy and its files as executable..."
82
82
chmod + x ./ devproxy ./ libe_sqlite3.dylib
83
83
}
0 commit comments