Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating Shell(Stream) without PTY #1419

Merged
merged 17 commits into from
Jun 16, 2024
Merged
Prev Previous commit
Next Next commit
Fix Integration Test
scott-xu committed May 31, 2024
commit ed8aca32b258a3febc2d4cc2425a0f279a2e6520
5 changes: 4 additions & 1 deletion src/Renci.SshNet/ShellStream.cs
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ public class ShellStream : Stream
private readonly object _sync = new object();

private readonly byte[] _writeBuffer;
private readonly bool _disablePTY;
private int _writeLength; // The length of the data in _writeBuffer.

private byte[] _readBuffer;
@@ -173,6 +174,8 @@ internal ShellStream(ISession session, int bufferSize)
_readBuffer = new byte[bufferSize];
_writeBuffer = new byte[bufferSize];

_disablePTY = true;

try
{
_channel.Open();
@@ -897,7 +900,7 @@ public override void Write(byte[] buffer, int offset, int count)
/// <exception cref="ObjectDisposedException">The stream is closed.</exception>
public void WriteLine(string line)
{
Write(line + "\r");
Write(line + (_disablePTY ? "\n" : "\r"));
}

/// <inheritdoc/>