diff --git a/GitTfs/Core/GitHelpers.cs b/GitTfs/Core/GitHelpers.cs index 0cff0e40..5d72704d 100644 --- a/GitTfs/Core/GitHelpers.cs +++ b/GitTfs/Core/GitHelpers.cs @@ -83,7 +83,6 @@ namespace Sep.Git.Tfs.Core public override void Close() { - process.StandardOutput.Close(); helper.Close(process); } @@ -191,6 +190,14 @@ namespace Sep.Git.Tfs.Core private void Close(Process process) { + // if caller doesn't read entire stdout to the EOF - it is possible that + // child process will hang waiting until there will be free space in stdout + // buffer to write the rest of the output. To prevent such situation we'll + // 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.WaitForExit((int)TimeSpan.FromSeconds(10).TotalMilliseconds)) throw new GitCommandException("Command did not terminate.", process); if(process.ExitCode != 0)