Skip to content

Commit

Permalink
Undo accidental changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechNagorski committed Apr 21, 2023
1 parent 3a4b62f commit 984c5c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Renci.SshNet/ShellStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace Renci.SshNet
public class ShellStream : Stream
{
private const string CrLf = "\r\n";
private const string Cr = "\n";

private readonly ISession _session;
private readonly Encoding _encoding;
Expand Down Expand Up @@ -621,14 +620,14 @@ public string ReadLine(TimeSpan timeout)
text = _encoding.GetString(_incoming.ToArray(), 0, _incoming.Count);
}

var index = text.IndexOf(Cr, StringComparison.Ordinal);
var index = text.IndexOf(CrLf, StringComparison.Ordinal);

if (index >= 0)
{
text = text.Substring(0, index);

// determine how many bytes to remove from buffer
var bytesProcessed = _encoding.GetByteCount(text + Cr);
var bytesProcessed = _encoding.GetByteCount(text + CrLf);

// remove processed bytes from the queue
for (var i = 0; i < bytesProcessed; i++)
Expand Down

0 comments on commit 984c5c3

Please sign in to comment.