Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ Fix steps:
if ($ReleaseTagToUse) {
$ReleaseVersion = $ReleaseTagToUse
} else {
$ReleaseVersion = (Get-PSCommitId) -replace '^v'
$ReleaseVersion = (Get-PSCommitId -WarningAction SilentlyContinue) -replace '^v'
}

Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" "$($Options.Output)" --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
Expand Down
24 changes: 24 additions & 0 deletions test/powershell/engine/Api/BasicEngine.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,27 @@ Describe 'Basic engine APIs' -Tags "CI" {
}
}
}

Describe "Clean up open Runspaces when exit powershell process" -Tags "Feature" {
It "PowerShell process should not freeze at exit" {
$command = @'
-c $rs = [runspacefactory]::CreateRunspacePool(1,5)
$rs.Open()
$ps = [powershell]::Create()
$ps.RunspacePool = $rs
$null = $ps.AddScript(1).Invoke()
write-host should_not_hang_at_exit
exit
'@
$process = Start-Process pwsh -ArgumentList $command -PassThru
Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 1000 > $null

$expect = "powershell process exits in 5 seconds"
if (-not $process.HasExited) {
Stop-Process -InputObject $process -Force -ErrorAction SilentlyContinue
"powershell process doesn't exit in 5 seconds" | Should Be $expect
} else {
$expect | Should Be $expect
}
}
}