diff --git a/src/Mercurial.Net/PersistentClient.cs b/src/Mercurial.Net/PersistentClient.cs index fb3dd84..ab9a0ec 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) + { + Debug.WriteLine("Prevented attempt to close already disposed StandardInput"); + } + finally + { + _Process = null; + } - _Process.StandardInput.Close(); - _Process.WaitForExit(); - _Process = null; } } }