Skip to content

Commit

Permalink
fix return when running in scriptblock
Browse files Browse the repository at this point in the history
  • Loading branch information
jpawlowski committed Aug 28, 2024
1 parent 4e0c6e8 commit 7ee391c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/powershell-extended/Install-NerdFont.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ begin {
$Name = Show-Menu -Options $allNerdFonts
if ($Name -eq 'quit') {
Write-Host "Selection process canceled."
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '') {
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '&') {
# Running as a script block
return
}
Expand All @@ -760,15 +760,15 @@ begin {
}
else {
Write-Host 'No font selected.'
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '') {
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '&') {
# Running as a script block
return
}
else {
# Running as a standalone script
exit
}
}
}
}
elseif ($PSBoundParameters.Name) {
$Name = $PSBoundParameters.Name
Expand All @@ -783,15 +783,15 @@ begin {

if ($nerdFontsToInstall.Count -eq 0) {
Write-Error "No matching fonts found."
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '') {
if ($null -eq $MyInvocation.InvocationName -or $MyInvocation.InvocationName -eq '&') {
# Running as a script block
return
}
else {
# Running as a standalone script
exit
}
}
}

# Fetch releases for each unique URL
$fontReleases = @{}
Expand Down

0 comments on commit 7ee391c

Please sign in to comment.