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
Original file line number Diff line number Diff line change
Expand Up @@ -1511,8 +1511,10 @@ private void ProcessErrorThread(object state)
while (true)
{
string error = ReadError(reader);
if (string.IsNullOrEmpty(error))

if (error.Length == 0)
{
// Ignore
continue;
}

Expand All @@ -1524,6 +1526,10 @@ private void ProcessErrorThread(object state)
HandleSSHError(psrte);
}
}
catch (ObjectDisposedException)
{
// Normal reader thread end.
}
catch (Exception e)
{
string errorMsg = (e.Message != null) ? e.Message : string.Empty;
Expand All @@ -1548,7 +1554,13 @@ private static string ReadError(StreamReader reader)
// Blocking read from StdError stream
string error = reader.ReadLine();

if (string.IsNullOrEmpty(error) ||
if (error == null)
{
// Stream is closed unexpectedly.
throw new PSInvalidOperationException(RemotingErrorIdStrings.SSHAbruptlyTerminated);
}

if ((error.Length == 0) ||
error.IndexOf("WARNING:", StringComparison.OrdinalIgnoreCase) > -1)
{
// Handle as interactive warning message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1636,4 +1636,7 @@ All WinRM sessions connected to Windows PowerShell session configurations, such
<data name="InvalidRoleCapabilityFileExtension" xml:space="preserve">
<value>The provided role capability file {0} does not have the required .psrc extension.</value>
</data>
<data name="SSHAbruptlyTerminated" >
<value>The SSH transport process has abruptly terminated causing this remote session to break.</value>
</data>
</root>