From b9ccf40aeb8e6e3c4c733a1764e5bc5e0e37f44b Mon Sep 17 00:00:00 2001 From: Philippe Ballandras Date: Tue, 16 Jan 2024 14:22:19 -0500 Subject: [PATCH] Update get-latest-tgf.ps1 script to require PowerShell 7 or higher (#415) --- README.md | 2 +- get-latest-tgf.ps1 | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bba1f93..a935b9d4 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ You can run the `get-latest-tgf.sh` script to check if you have the latest versi curl https://raw.githubusercontent.com/coveooss/tgf/master/get-latest-tgf.sh | bash ``` -On `Windows`, run `get-latest-tgf.ps1` with Powershell: +On `Windows`, run `get-latest-tgf.ps1` with Powershell (version 7.x or more): ```PowerShell (Invoke-WebRequest https://raw.githubusercontent.com/coveooss/tgf/master/get-latest-tgf.ps1).Content | Invoke-Expression diff --git a/get-latest-tgf.ps1 b/get-latest-tgf.ps1 index 849294e3..d24538fe 100644 --- a/get-latest-tgf.ps1 +++ b/get-latest-tgf.ps1 @@ -1,5 +1,11 @@ $ErrorActionPreference = "Stop" #Make all errors terminating +# This script uses Powershell 7 features. Make sure we are running in Powershell 7. +if ($PSVersionTable.PSVersion.Major -lt 7) { + Write-Host "The tgf install script requires PowerShell 7 or higher. Please install PowerShell 7 and try again." + Exit 1 +} + try { $latestReleaseRequest = @{ Method = "HEAD"