From 0e6f46aa0ba77a946ef332013a7a89038fc63395 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Mon, 8 Aug 2022 05:38:55 -0700 Subject: [PATCH] Avoid null coalescing operator for pwsh 6 support Fixes #157417 --- .../contrib/terminal/browser/media/shellIntegration.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 index 5d7d4436094..53767db552c 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 @@ -36,7 +36,11 @@ function Global:Prompt() { # Sanitize the command line to ensure it can get transferred to the terminal and can be parsed # correctly. This isn't entirely safe but good for most cases, it's important for the Pt parameter # to only be composed of _printable_ characters as per the spec. - $CommandLine = $LastHistoryEntry.CommandLine ?? "" + if ($LastHistoryEntry.CommandLine) { + $CommandLine = $LastHistoryEntry.CommandLine + } else { + $CommandLine = "" + } $Result += $CommandLine.Replace("`n", "").Replace(";", "") $Result += "`a" # Command finished exit code