sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
3.96k stars 931 forks source link

shellStream.ReadLine() does not return last line #1310

Closed MiiChielHD closed 7 months ago

MiiChielHD commented 7 months ago

With some machines with SSH I don't have this issue, but with a few the following happens:

If I compare the output with MobaXTerm, in MobaXterm after executing a command I always get a new line with for instance:

hostname
<shows hostname>
root@hostname: /home/hostname

When executing a command with shellstream.Write("hostname"), I then use shellstream.ReadLine(Timespan.FromSeconds(5)) which gives me:

hostname
<shows hostname>

but it lacks the last line. This also with other prompts... root@hostname: /home/hostname

What am I missing here? I tried using shellstream.flush before reading... but that didn't do the job... I can do many readline actions afterwards, yet I don't get that last line in return, so it isn't a time issue.

MiiChielHD commented 7 months ago

Seems that if I use shellStream.Read() afterwards I get the last line.

WojciechNagorski commented 7 months ago

This issue has been fixed in the 2024.0.0 version.

MiiChielHD commented 7 months ago

Excellent, I'm looking forward to it for testing