Skip to content

Commit 47ba58f

Browse files
committed
diagnose: don't await Git exit on config list
Do not wait for the Git process to exit until we start reading from the stdout stream, to prevent a deadlock. This is what we do in the product code too.
1 parent 10935fb commit 47ba58f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shared/Core/Diagnostics/GitDiagnostic.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ protected override Task<bool> RunInternalAsync(StringBuilder log, IList<string>
3232
log.Append("Listing all Git configuration...");
3333
Process configProc = _git.CreateProcess("config --list --show-origin");
3434
configProc.Start();
35-
configProc.WaitForExit();
35+
// To avoid deadlocks, always read the output stream first and then wait
36+
// TODO: don't read in all the data at once; stream it
3637
string gitConfig = configProc.StandardOutput.ReadToEnd().TrimEnd();
38+
configProc.WaitForExit();
3739
log.AppendLine(" OK");
3840
log.AppendLine("Git configuration:");
3941
log.AppendLine(gitConfig);

0 commit comments

Comments
 (0)