Skip to content

Commit b97db18

Browse files
anthony-c-martinwyunchi-ms
authored andcommitted
Sync
1 parent fcb9bea commit b97db18

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Resources/ResourceManager/Utilities/ProcessInvoker.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,20 @@ public ProcessOutput Invoke(ProcessInput input)
9999
}
100100
}
101101

102+
var stderr = new StringBuilder();
103+
proc.ErrorDataReceived += (sender, e) => stderr.AppendLine(e.Data);
102104
proc.Start();
103-
var stdout = proc.StandardOutput.ReadToEnd();
104-
var stderr = proc.StandardError.ReadToEnd();
105+
106+
// To avoid deadlocks, use an asynchronous read operation on at least one of the streams.
107+
proc.BeginErrorReadLine();
108+
var stdout = proc.StandardOutput.ReadToEnd();
105109
proc.WaitForExit();
106-
110+
107111
return new ProcessOutput {
108112
Stdout = stdout,
109-
Stderr = stderr,
113+
Stderr = stderr.ToString(),
110114
ExitCode = proc.ExitCode
111115
};
112116
}
113117
}
114-
}
118+
}

src/Resources/Resources/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed deadlock in Bicep CLI execution. [#24133]
2223

2324
## Version 6.15.0
2425
* Supported `-SkipClientSideScopeValidation` in RoleAssignment and RoleDefinition related commands. [#22473]

0 commit comments

Comments
 (0)