Skip to content

Commit

Permalink
Fix: For Window Build Setup, Cope with Short Prompts
Browse files Browse the repository at this point in the history
winscripts/gccsetup.ps1 + winscripts/msvcsetup.ps1 prefix the
PowerShell prompt with "GCC " or "MVS " respectively, if not already
so prefixed. In checking the existing prompt for GCC/MVS, the
powershell code was throwing an exception if the existing prompt was
shorter than 3 chars. Now coping correctly with that case.
  • Loading branch information
dgreatwood committed Nov 11, 2024
1 parent 8da273d commit 2100713
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion winscripts/gccsetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ if ((! ($env:plain_prompt)) -or ($env:plain_prompt -ne "Y"))
$prompt_existing = (Get-Command prompt).ScriptBlock
if ($prompt_existing) {
$prompt_current=(prompt)
if (! ($prompt_current.SubString(0, 3) -eq "GCC")) {
if ((!$prompt_current) -or ($prompt_current.length -lt 3)) {
function global:prompt {"MVS> "}
}
elseif (! ($prompt_current.SubString(0, 3) -eq "GCC")) {
$prompt_new = "`"GCC `" + " + $prompt_existing
$def_fn_prompt_new = `
"function global:prompt { " + $prompt_new + " }"
Expand Down
5 changes: 4 additions & 1 deletion winscripts/msvcsetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ if ((! ($env:plain_prompt)) -or ($env:plain_prompt -ne "Y"))
$prompt_existing = (Get-Command prompt).ScriptBlock
if ($prompt_existing) {
$prompt_current=(prompt)
if (! ($prompt_current.SubString(0, 3) -eq "MVS")) {
if ((!$prompt_current) -or ($prompt_current.length -lt 3)) {
function global:prompt {"MVS> "}
}
elseif (! ($prompt_current.SubString(0, 3) -eq "MVS")) {
$prompt_new = "`"MVS `" + " + $prompt_existing
$def_fn_prompt_new = `
"function global:prompt { " + $prompt_new + " }"
Expand Down

0 comments on commit 2100713

Please sign in to comment.