Fix blocking wait when starting file associated with a Windows application (#13750)

* Fix blocking wait when starting file associated with a Windows application in elevated process

* refactor check if app is WindowsApp
This commit is contained in:
Steve Lee
2020-10-07 12:58:24 +05:00
committed by GitHub
parent c3b29cf0e7
commit 16cc9aaaf8
2 changed files with 18 additions and 39 deletions
@@ -144,6 +144,15 @@ Describe "Native Command Processor" -tags "Feature" {
It '$ErrorActionPreference does not apply to redirected stderr output' -Skip:(!$EnabledExperimentalFeatures.Contains('PSNotApplyErrorActionToStderr')) {
pwsh -noprofile -command '$ErrorActionPreference = ''Stop''; testexe -stderr stop 2>$null; ''hello''; $error; $?' | Should -BeExactly 'hello','True'
}
It 'Can start an elevated associated process correctly' -Skip:(
!$IsWindows -or (!(Test-Path (Join-Path -Path $env:windir -ChildPath 'system32' -AdditionalChildPath 'diskmgmt.msc')))
) {
# test bug https://github.com/PowerShell/PowerShell/issues/13744 where console is blocked
diskmgmt.msc
Wait-UntilTrue -sb { (Get-Process mmc).Count -gt 0 } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 1000 | Should -BeTrue
Get-Process mmc | Stop-Process
}
}
Describe "Open a text file with NativeCommandProcessor" -tags @("Feature", "RequireAdminOnWindows") {