diff --git a/src/Renci.SshNet/Channels/ChannelSession.cs b/src/Renci.SshNet/Channels/ChannelSession.cs
index 52c31522c..cb8bedc69 100644
--- a/src/Renci.SshNet/Channels/ChannelSession.cs
+++ b/src/Renci.SshNet/Channels/ChannelSession.cs
@@ -239,26 +239,18 @@ public bool SendSubsystemRequest(string subsystem)
/// The rows.
/// The width.
/// The height.
- ///
- /// if request was successful; otherwise .
- ///
- public bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height)
+ public void SendWindowChangeRequest(uint columns, uint rows, uint width, uint height)
{
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new WindowChangeRequestInfo(columns, rows, width, height)));
- return true;
}
///
/// Sends the local flow request.
///
/// if set to [client can do].
- ///
- /// if request was successful; otherwise .
- ///
- public bool SendLocalFlowRequest(bool clientCanDo)
+ public void SendLocalFlowRequest(bool clientCanDo)
{
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new XonXoffRequestInfo(clientCanDo)));
- return true;
}
///
diff --git a/src/Renci.SshNet/Channels/IChannelSession.cs b/src/Renci.SshNet/Channels/IChannelSession.cs
index 21fe4c158..b8bcf22a7 100644
--- a/src/Renci.SshNet/Channels/IChannelSession.cs
+++ b/src/Renci.SshNet/Channels/IChannelSession.cs
@@ -97,19 +97,13 @@ bool SendPseudoTerminalRequest(string environmentVariable,
/// The rows.
/// The width.
/// The height.
- ///
- /// if request was successful; otherwise .
- ///
- bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height);
+ void SendWindowChangeRequest(uint columns, uint rows, uint width, uint height);
///
/// Sends the local flow request.
///
/// if set to [client can do].
- ///
- /// if request was successful; otherwise .
- ///
- bool SendLocalFlowRequest(bool clientCanDo);
+ void SendLocalFlowRequest(bool clientCanDo);
///
/// Sends the signal request.
diff --git a/src/Renci.SshNet/IServiceFactory.cs b/src/Renci.SshNet/IServiceFactory.cs
index 8fea7decc..c042e5455 100644
--- a/src/Renci.SshNet/IServiceFactory.cs
+++ b/src/Renci.SshNet/IServiceFactory.cs
@@ -109,7 +109,7 @@ internal partial interface IServiceFactory
/// The SSH session.
/// The TERM environment variable.
/// The terminal width in columns.
- /// The terminal width in rows.
+ /// The terminal height in rows.
/// The terminal width in pixels.
/// The terminal height in pixels.
/// The terminal mode values.
diff --git a/src/Renci.SshNet/ISshClient.cs b/src/Renci.SshNet/ISshClient.cs
index 1d6edfebf..4507c316b 100644
--- a/src/Renci.SshNet/ISshClient.cs
+++ b/src/Renci.SshNet/ISshClient.cs
@@ -186,7 +186,7 @@ public interface ISshClient : IBaseClient
///
/// The TERM environment variable.
/// The terminal width in columns.
- /// The terminal width in rows.
+ /// The terminal height in rows.
/// The terminal width in pixels.
/// The terminal height in pixels.
/// The size of the buffer.
@@ -200,7 +200,7 @@ public interface ISshClient : IBaseClient
/// You can get a detailed list of these capabilities by using the ‘infocmp’ command.
///
///
- /// The column/row dimensions override the pixel dimensions(when nonzero). Pixel dimensions refer
+ /// The column/row dimensions override the pixel dimensions (when nonzero). Pixel dimensions refer
/// to the drawable area of the window.
///
///
@@ -211,7 +211,7 @@ public interface ISshClient : IBaseClient
///
/// The TERM environment variable.
/// The terminal width in columns.
- /// The terminal width in rows.
+ /// The terminal height in rows.
/// The terminal width in pixels.
/// The terminal height in pixels.
/// The size of the buffer.
@@ -226,7 +226,7 @@ public interface ISshClient : IBaseClient
/// You can get a detailed list of these capabilities by using the ‘infocmp’ command.
///
///
- /// The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
+ /// The column/row dimensions override the pixel dimensions (when non-zero). Pixel dimensions refer
/// to the drawable area of the window.
///
///
diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs
index 0b8e27f67..3dc5ec348 100644
--- a/src/Renci.SshNet/ServiceFactory.cs
+++ b/src/Renci.SshNet/ServiceFactory.cs
@@ -177,31 +177,7 @@ public ISftpResponseFactory CreateSftpResponseFactory()
return new SftpResponseFactory();
}
- ///
- /// Creates a shell stream.
- ///
- /// The SSH session.
- /// The TERM environment variable.
- /// The terminal width in columns.
- /// The terminal width in rows.
- /// The terminal width in pixels.
- /// The terminal height in pixels.
- /// The terminal mode values.
- /// The size of the buffer.
- ///
- /// The created instance.
- ///
- /// Client is not connected.
- ///
- ///
- /// The TERM environment variable contains an identifier for the text window's capabilities.
- /// You can get a detailed list of these capabilities by using the ‘infocmp’ command.
- ///
- ///
- /// The column/row dimensions override the pixel dimensions(when non-zero). Pixel dimensions refer
- /// to the drawable area of the window.
- ///
- ///
+ ///
public ShellStream CreateShellStream(ISession session, string terminalName, uint columns, uint rows, uint width, uint height, IDictionary terminalModeValues, int bufferSize)
{
return new ShellStream(session, terminalName, columns, rows, width, height, terminalModeValues, bufferSize);
diff --git a/src/Renci.SshNet/ShellStream.cs b/src/Renci.SshNet/ShellStream.cs
index 9a72532c8..f64ad9362 100644
--- a/src/Renci.SshNet/ShellStream.cs
+++ b/src/Renci.SshNet/ShellStream.cs
@@ -281,6 +281,25 @@ public override void SetLength(long value)
throw new NotSupportedException();
}
+ ///
+ /// Sends new dimensions of the window (terminal) to the server.
+ ///
+ /// The terminal width in columns.
+ /// The terminal height in rows.
+ /// The terminal width in pixels.
+ /// The terminal height in pixels.
+ ///
+ /// The column/row dimensions override the pixel dimensions (when nonzero). Pixel dimensions refer
+ /// to the drawable area of the window.
+ ///
+ /// The stream is closed.
+ public void ChangeWindowSize(uint columns, uint rows, uint width, uint height)
+ {
+ ThrowHelper.ThrowObjectDisposedIf(_disposed, this);
+
+ _channel.SendWindowChangeRequest(columns, rows, width, height);
+ }
+
///
/// Expects the specified expression and performs action when one is found.
///
diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs
index 813300fc4..37fda2b88 100644
--- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs
@@ -123,6 +123,30 @@ public void Write_AfterDispose_ThrowsObjectDisposedException()
Assert.ThrowsException(() => shellStream.Write(bytes, 0, bytes.Length));
}
+ [TestMethod]
+ public void ChangeWindowSize_AfterDispose_ThrowsObjectDisposedException()
+ {
+ var shellStream = CreateShellStream();
+
+ _channelSessionMock.Setup(p => p.Dispose());
+
+ shellStream.Dispose();
+
+ Assert.ThrowsException(() => shellStream.ChangeWindowSize(80, 25, 0, 0));
+ }
+
+ [TestMethod]
+ public void ChangeWindowSize_SendsWindowChangeRequest()
+ {
+ var shellStream = CreateShellStream();
+
+ _channelSessionMock.Setup(s => s.SendWindowChangeRequest(80, 25, 0, 1));
+
+ shellStream.ChangeWindowSize(80, 25, 0, 1);
+
+ _channelSessionMock.Verify(v => v.SendWindowChangeRequest(80, 25, 0, 1), Times.Once());
+ }
+
private ShellStream CreateShellStream()
{
_sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs
index 17ee517a9..3a9d26fcb 100644
--- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs
+++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs
@@ -426,13 +426,13 @@ public void Open()
public bool SendKeepAliveRequest() => throw new NotImplementedException();
- public bool SendLocalFlowRequest(bool clientCanDo) => throw new NotImplementedException();
+ public void SendLocalFlowRequest(bool clientCanDo) => throw new NotImplementedException();
public bool SendSignalRequest(string signalName) => throw new NotImplementedException();
public bool SendSubsystemRequest(string subsystem) => throw new NotImplementedException();
- public bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height) => throw new NotImplementedException();
+ public void SendWindowChangeRequest(uint columns, uint rows, uint width, uint height) => throw new NotImplementedException();
public bool SendX11ForwardingRequest(bool isSingleConnection, string protocol, byte[] cookie, uint screenNumber) => throw new NotImplementedException();
#pragma warning restore IDE0022 // Use block body for method