Merge pull request #157505 from microsoft/tyriar/157417

Avoid null coalescing operator for pwsh 6 support
This commit is contained in:
Daniel Imms
2022-08-08 07:53:27 -07:00
committed by GitHub
@@ -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