From cd4babc00fa11024bfe14b3c60c3aea260bc7fc7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 18 Dec 2011 23:13:07 -0500 Subject: [PATCH] Only close stdout if it has been redirected. git-tfs will crash if it attempts to close stdout from a process from which stdout has not been redirected. This adds a guard against closing process's stdout that has not been redirected. --- GitTfs/Core/GitHelpers.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GitTfs/Core/GitHelpers.cs b/GitTfs/Core/GitHelpers.cs index 5d72704d..e23e705c 100644 --- a/GitTfs/Core/GitHelpers.cs +++ b/GitTfs/Core/GitHelpers.cs @@ -196,7 +196,8 @@ namespace Sep.Git.Tfs.Core // close stdout to indicate we're no more interested in it, thus allowing // child process to proceed. // See https://github.com/git-tfs/git-tfs/issues/121 for details. - process.StandardOutput.Close(); + if (process.StartInfo.RedirectStandardOutput) + process.StandardOutput.Close(); if (!process.WaitForExit((int)TimeSpan.FromSeconds(10).TotalMilliseconds)) throw new GitCommandException("Command did not terminate.", process);