SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

Shell's IDisposable implementation must dispose input stream if we own it

Open drieseng opened this issue 1 year ago • 2 comments

We have a few CreateShell(...) overloads on SshClient were we create the input stream that we pass to Shell. When the Shell instance is disposed, we should dispose that input stream as well. We should add CreateShell(...) overloads were we add a (bool) leaveOpen argument.

drieseng avatar Oct 26 '23 09:10 drieseng

@drieseng, do you (or anyone else) know why there exists both Shell and ShellStream which both create a shell but don't seem to use each other?

I have been wondering if as part of fixing issues with them both, we should have one (i.e. Shell) which exposes lower level interaction, and the other (i.e. ShellStream but possibly renamed) which wraps Shell and exposes the higher level operations like Expect. I imagine this exposing StreamReader/StreamWriter properties much like System.Diagnostics.Process with its StandardOutput/StandardError/StandardInput properties.

Rob-Hague avatar Oct 26 '23 11:10 Rob-Hague

We do see a problem when use ShellStream. If the server sends channel close message to client, there's no where to know that until next Write.

scott-xu avatar Feb 19 '24 14:02 scott-xu