diff --git a/src/Renci.SshNet/ShellStream.cs b/src/Renci.SshNet/ShellStream.cs index 40325a0bb..b4c2d067e 100644 --- a/src/Renci.SshNet/ShellStream.cs +++ b/src/Renci.SshNet/ShellStream.cs @@ -872,6 +872,23 @@ public void WriteLine(string line) Write(line + (_noTerminal ? "\n" : "\r")); } + /// + /// Change the terminal size. + /// + /// new columns of the terminal. + /// new rows of the terminal. + /// new width of the terminal. + /// new height of the terminal. + /// + /// if request was successful; otherwise . + /// + public bool SendWindowChangeRequest(uint columns, uint rows, uint width, uint height) + { + ThrowHelper.ThrowObjectDisposedIf(_disposed, this); + + return _channel.SendWindowChangeRequest(columns, rows, width, height); + } + /// protected override void Dispose(bool disposing) { diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs index 813300fc4..5cd0651c9 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -123,6 +123,18 @@ public void Write_AfterDispose_ThrowsObjectDisposedException() Assert.ThrowsException(() => shellStream.Write(bytes, 0, bytes.Length)); } + [TestMethod] + public void SendWindowChangeRequest_ThrowsObjectDisposedException() + { + var shellStream = CreateShellStream(); + + _channelSessionMock.Setup(p => p.Dispose()); + + shellStream.Dispose(); + + Assert.ThrowsException(() => shellStream.SendWindowChangeRequest(80, 24, 0, 0)); + } + private ShellStream CreateShellStream() { _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);