Bring back MainWindowTitle in PSHostProcessInfo (#11885)

* Bring back MainWindowTitle in PSHostProcessInfo

* Add test
This commit is contained in:
Ilya
2020-03-10 09:30:53 -07:00
committed by GitHub
parent b04f0e4fc5
commit 12bf5f4a0c
2 changed files with 5 additions and 4 deletions
@@ -765,7 +765,6 @@ namespace Microsoft.PowerShell.Commands
private set;
}
#if !CORECLR
/// <summary>
/// Main window title of the process.
/// </summary>
@@ -774,7 +773,6 @@ namespace Microsoft.PowerShell.Commands
get;
private set;
}
#endif
#endregion
@@ -794,7 +792,6 @@ namespace Microsoft.PowerShell.Commands
if (string.IsNullOrEmpty(appDomainName)) { throw new PSArgumentNullException("appDomainName"); }
#if !CORECLR
MainWindowTitle = string.Empty;
try
{
@@ -803,7 +800,6 @@ namespace Microsoft.PowerShell.Commands
}
catch (ArgumentException) { }
catch (InvalidOperationException) { }
#endif
this.ProcessName = processName;
this.ProcessId = processId;
@@ -29,6 +29,11 @@ Describe "Get-PSHostProcessInfo tests" -Tag CI {
(Get-PSHostProcessInfo).ProcessId | Should -Contain $PID
}
It "Should return own self window title" {
$expected = (Get-Process -Id $PID).MainWindowTitle
(Get-PSHostProcessInfo -Id $PID).MainWindowTitle | Should -BeExactly $expected
}
It "Should list info for other PowerShell hosted processes" {
# Creation of the named pipe is async
Wait-UntilTrue {