Avoid null coalescing operator for pwsh 6 support

Fixes #157417
This commit is contained in:
Daniel Imms
2022-08-08 05:38:55 -07:00
parent 34f184263d
commit 0e6f46aa0b
@@ -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", "<LF>").Replace(";", "<CL>")
$Result += "`a"
# Command finished exit code