Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix wrong error entry when build failed

  • Loading branch information...
commit e78c10df220288fdcc6351248b42c21280e08f6f 1 parent 286c70e
@suwatch suwatch authored
View
9 Kudu.Core/Deployment/Generator/ExternalCommandBuilder.cs
@@ -64,7 +64,7 @@ protected void RunCommand(DeploymentContext context, string command)
{
exe.ExecuteWithProgressWriter(customLogger, context.Tracer, ExternalCommandFactory.ShouldFilterOutMsBuildWarnings, ExternalCommandFactory.ShouldFilterOutNodeRedundantOutput, command, String.Empty);
}
- catch (CommandLineException ex)
+ catch (Exception ex)
{
context.Tracer.TraceError(ex);
@@ -73,12 +73,7 @@ protected void RunCommand(DeploymentContext context, string command)
// msbuild has already been captured.
context.GlobalLogger.LogError();
- // Add the output stream and the error stream to the log for better
- // debugging
- customLogger.Log(ex.Output, LogEntryType.Error);
- customLogger.Log(ex.Error, LogEntryType.Error);
-
- throw new CommandLineException(ex.Message, ex);
+ throw;
}
finally
{
View
8 Kudu.Core/Deployment/Generator/GeneratorSiteBuilder.cs
@@ -39,7 +39,6 @@ public override Task Build(DeploymentContext context)
}
catch (Exception ex)
{
- buildLogger.Log(ex);
tcs.SetException(ex);
}
@@ -74,7 +73,7 @@ private void GenerateScript(DeploymentContext context, ILogger buildLogger)
scriptGenerator.ExecuteWithProgressWriter(buildLogger, context.Tracer, _ => false, _ => false, scriptGeneratorCommand);
}
}
- catch (CommandLineException ex)
+ catch (Exception ex)
{
context.Tracer.TraceError(ex);
@@ -83,11 +82,6 @@ private void GenerateScript(DeploymentContext context, ILogger buildLogger)
// msbuild has already been captured.
context.GlobalLogger.LogError();
- // Add the output stream and the error stream to the log for better
- // debugging
- buildLogger.Log(ex.Output, LogEntryType.Error);
- buildLogger.Log(ex.Error, LogEntryType.Error);
-
throw;
}
}
View
72 Kudu.Core/Infrastructure/Executable.cs
@@ -227,36 +227,56 @@ public void Execute(ITracer tracer, Stream input, Stream output, string argument
public Tuple<string, string> ExecuteWithProgressWriter(ILogger logger, ITracer tracer, Func<string, bool> shouldFilterOutOutput, Func<string, bool> shouldFilterOutError, string arguments, params object[] args)
{
- using (var writer = new ProgressWriter())
+ try
{
- writer.Start();
+ using (var writer = new ProgressWriter())
+ {
+ writer.Start();
- return Execute(tracer,
- output =>
- {
- if (shouldFilterOutOutput(output))
+ return Execute(tracer,
+ output =>
{
- return false;
- }
-
- writer.WriteOutLine(output);
- logger.Log(output);
- return true;
- },
- error =>
- {
- if (shouldFilterOutError(error))
+ if (shouldFilterOutOutput(output))
+ {
+ return false;
+ }
+
+ writer.WriteOutLine(output);
+ logger.Log(output);
+ return true;
+ },
+ error =>
{
- return false;
- }
-
- writer.WriteErrorLine(error);
- logger.Log(error, LogEntryType.Error);
- return true;
- },
- Console.OutputEncoding,
- arguments,
- args);
+ if (shouldFilterOutError(error))
+ {
+ return false;
+ }
+
+ writer.WriteErrorLine(error);
+ logger.Log(error, LogEntryType.Error);
+ return true;
+ },
+ Console.OutputEncoding,
+ arguments,
+ args);
+ }
+ }
+ catch (CommandLineException exception)
+ {
+ // in case of failure without stderr, we log error explicitly
+ if (String.IsNullOrEmpty(exception.Error))
+ {
+ logger.Log(exception);
@amitapl Owner
amitapl added a note

why do you need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+
+ throw;
+ }
+ catch (Exception exception)
+ {
+ // in case of other failure, we log error explicitly
+ logger.Log(exception);
+
+ throw;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.