From da9c8e228a5b2dff769bbda348dc9e5b5efefc56 Mon Sep 17 00:00:00 2001 From: Richard Kuhnt Date: Tue, 12 Dec 2017 21:39:52 +0100 Subject: [PATCH] Use -Path instead of -InputStream parameter for Get-FileHash (closes #1905) Fixes a problem with Get-FileHash not excepting -InputStream parameter in PowerShell 4.0 --- lib/install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/install.ps1 b/lib/install.ps1 index 7c81b409b..91f057d63 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -452,10 +452,10 @@ function check_hash($file, $url, $manifest, $arch) { function compute_hash($file, $algname) { try { - $fs = [system.io.file]::openread($file) if([bool](Get-Command -Name Get-FileHash -ErrorAction SilentlyContinue) -eq $true) { - return (Get-FileHash -InputStream $fs -Algorithm $algname).Hash.ToLower() + return (Get-FileHash -Path $file -Algorithm $algname).Hash.ToLower() } else { + $fs = [system.io.file]::openread($file) $alg = [system.security.cryptography.hashalgorithm]::create($algname) $hexbytes = $alg.computehash($fs) | % { $_.tostring('x2') } return [string]::join('', $hexbytes)