From a993ccafeb35b49aad98191f8a15e54210bec637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A3=D1=82=D0=B8=D0=BD=20=D0=90=D1=80=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=20=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Fri, 29 Dec 2017 16:21:28 +1000 Subject: [PATCH 1/2] added try catch block --- src/Mercurial.Net/PersistentClient.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Mercurial.Net/PersistentClient.cs b/src/Mercurial.Net/PersistentClient.cs index fb3dd84..f7b66ee 100644 --- a/src/Mercurial.Net/PersistentClient.cs +++ b/src/Mercurial.Net/PersistentClient.cs @@ -452,11 +452,22 @@ private void DecodeInitialBlock() private void StopPersistentMercurialClient() { if (_Process == null) - return; + return; + + try + { + _Process.StandardInput.Close(); + _Process.WaitForExit(); + } + catch(ObjectDisposedException) + { + + } + finally + { + _Process = null; + } - _Process.StandardInput.Close(); - _Process.WaitForExit(); - _Process = null; } } } From dc9dffe03ad22dbb6c0fd02829effe6bca742d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A3=D1=82=D0=B8=D0=BD=20=D0=90=D1=80=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=20=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Tue, 9 Jan 2018 09:41:50 +1000 Subject: [PATCH 2/2] added Debug.WriteLine on catch --- src/Mercurial.Net/PersistentClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mercurial.Net/PersistentClient.cs b/src/Mercurial.Net/PersistentClient.cs index f7b66ee..ab9a0ec 100644 --- a/src/Mercurial.Net/PersistentClient.cs +++ b/src/Mercurial.Net/PersistentClient.cs @@ -461,7 +461,7 @@ private void StopPersistentMercurialClient() } catch(ObjectDisposedException) { - + Debug.WriteLine("Prevented attempt to close already disposed StandardInput"); } finally {