Skip to content

Commit e86c589

Browse files
authored
Ignored bicep warning message in error stream if exitcode equals zero (#14668)
Co-authored-by: Beisi Zhou <[email protected]>
1 parent 9ddcad0 commit e86c589

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Resources/ResourceManager/Utilities/BicepUtility.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,21 @@ public static string BuildFile(string bicepTemplateFilePath, OutputMethod output
8787
outputMethod(string.Format("Using Bicep v{0}", currentBicepVersion));
8888
result.ForEach(r => outputMethod(r.ToString()));
8989
}
90+
91+
string errorMsg = string.Empty;
9092
if (powershell.HadErrors)
9193
{
92-
string errorMsg = string.Empty;
9394
powershell.Streams.Error.ForEach(e => { errorMsg += (e + Environment.NewLine); });
95+
errorMsg = errorMsg.Substring(0, errorMsg.Length- Environment.NewLine.Length);
96+
outputMethod(errorMsg);
97+
}
98+
99+
powershell.AddScript("$LASTEXITCODE");
100+
result = powershell.Invoke();
101+
int.TryParse(result.ToString(), out int exitcode);
102+
103+
if (exitcode != 0)
104+
{
94105
throw new AzPSApplicationException(errorMsg);
95106
}
96107
}

src/Resources/Resources/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Ignored bicep warning message in error stream if exitcode equals zero.
2223

2324
## Version 3.4.0
2425
* Redirected bicep message to verbose stream
2526
* Removed the logic of copying Bicep template file to temp folder.
26-
* Add support of policy exemption resource type
27+
* Added support of policy exemption resource type
2728
* Fixed what-if functionality when using `-QueryString` parameter.
2829
* Normalized `-QueryString` starting with "?" for scenarios involving dynamic parameters.
2930

0 commit comments

Comments
 (0)