Added closing of stdout for child processes preventing the hang in some cases (fixes #121).
Also removed close in another place as it is redundant now.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user