If the SSH client process that PowerShell is using for the SSH transport terminates abruptly the StreamReader will return null instead of closing the pipe for a normal process exit.
The current error stream reading code ignores null StreamReader values resulting in a hang where the remote session never ends.
Steps to reproduce
PS > New-PSSession -HostName <cnName>
PS > Get-Process SSH | kill -force
Expected behavior
Session state goes to "Broken" with error message
Actual behavior
Session is broken and hangs on the client end
Environment data
If the SSH client process that PowerShell is using for the SSH transport terminates abruptly the StreamReader will return null instead of closing the pipe for a normal process exit.
The current error stream reading code ignores null StreamReader values resulting in a hang where the remote session never ends.
Steps to reproduce
Expected behavior
Actual behavior
Environment data