Merge pull request #1843 from eerhardt/FixSilentExec
Log StdErr StdOut when a failed command is executed in "silent" mode
This commit is contained in:
commit
605cc54930
1 changed files with 14 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||
|
@ -27,7 +28,19 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
|||
{
|
||||
if(ExitCode != 0)
|
||||
{
|
||||
throw new BuildFailureException($"Command failed with exit code {ExitCode}: {StartInfo.FileName} {StartInfo.Arguments}");
|
||||
StringBuilder message = new StringBuilder($"Command failed with exit code {ExitCode}: {StartInfo.FileName} {StartInfo.Arguments}");
|
||||
|
||||
if (!string.IsNullOrEmpty(StdOut))
|
||||
{
|
||||
message.AppendLine($"{Environment.NewLine}Standard Output:{Environment.NewLine}{StdOut}");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(StdErr))
|
||||
{
|
||||
message.AppendLine($"{Environment.NewLine}Standard Error:{Environment.NewLine}{StdErr}");
|
||||
}
|
||||
|
||||
throw new BuildFailureException(message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue