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.
This commit is contained in:
unknown
2011-12-18 23:13:07 -05:00
parent 8e90acd333
commit cd4babc00f
+2 -1
View File
@@ -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);