diff options
author | jiangjianshan <jiangjianshan1103@gmail.com> | 2021-01-28 10:41:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 11:41:23 +0900 |
commit | 3afa920151ed0fc8aaa245171317363dc9e4b9d9 (patch) | |
tree | 4a1f69f06b255bc438b32cd03f15064e8af655e5 /install.ps1 | |
parent | 32c493e994288f63c2ceec1dbeaadc5de7399552 (diff) |
[install.ps1] Change permission of the downloaded binary (#2308)
Fix #2256
Diffstat (limited to 'install.ps1')
-rw-r--r-- | install.ps1 | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/install.ps1 b/install.ps1 index bca6cada..6d4e6811 100644 --- a/install.ps1 +++ b/install.ps1 @@ -43,7 +43,11 @@ function download { $url="https://github.com/junegunn/fzf/releases/download/$version/$file" $temp=$env:TMP + "\fzf.zip" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - (New-Object Net.WebClient).DownloadFile($url, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$temp")) + if ($PSVersionTable.PSVersion.Major -ge 3) { + Invoke-WebRequest -Uri $url -OutFile $temp + } else { + (New-Object Net.WebClient).DownloadFile($url, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$temp")) + } if ($?) { (Microsoft.PowerShell.Archive\Expand-Archive -Path $temp -DestinationPath .); (Remove-Item $temp) } else { @@ -53,7 +57,7 @@ function download { $binary_error="Failed to download $file" return } - check_binary >$null + echo y | icacls $fzf_base\bin\fzf.exe /grant Administrator:F ; check_binary >$null } download "fzf-$version-windows_amd64.zip" |