diff --git a/source/Nuke.Tooling/Configure.cs b/source/Nuke.Tooling/Configure.cs index 52fc3d1f5..906d6a4f3 100644 --- a/source/Nuke.Tooling/Configure.cs +++ b/source/Nuke.Tooling/Configure.cs @@ -29,7 +29,6 @@ public static T InvokeSafe([CanBeNull] this Configure configurator, T obj) public static IReadOnlyCollection<(TSettings Settings, IReadOnlyCollection Output)> Invoke( this CombinatorialConfigure configurator, Func> executor, - Action logger, int degreeOfParallelism, bool completeOnFailure) where TSettings : ToolSettings, new() @@ -38,7 +37,6 @@ public static T InvokeSafe([CanBeNull] this Configure configurator, T obj) configurator, x => (Settings: x, Output: executor(x)), x => x.Output, - logger, degreeOfParallelism, completeOnFailure); } @@ -46,7 +44,6 @@ public static T InvokeSafe([CanBeNull] this Configure configurator, T obj) public static IReadOnlyCollection<(TSettings Settings, TResult Result, IReadOnlyCollection Output)> Invoke( this CombinatorialConfigure configurator, Func Output)> executor, - Action logger, int degreeOfParallelism, bool completeOnFailure) where TSettings : ToolSettings, new() @@ -55,7 +52,6 @@ public static T InvokeSafe([CanBeNull] this Configure configurator, T obj) configurator, x => (Settings: x, ReturnValue: executor(x)), x => x.ReturnValue.Output, - logger, degreeOfParallelism, completeOnFailure) .Select(x => (x.Settings, x.ReturnValue.Result, x.ReturnValue.Output)).ToList(); @@ -65,7 +61,6 @@ private static IReadOnlyCollection Invoke( CombinatorialConfigure configurator, Func executor, Func> outputSelector, - Action logger, int degreeOfParallelism, bool completeOnFailure) where TSettings : ToolSettings, new() @@ -106,10 +101,17 @@ private static IReadOnlyCollection Invoke( invocations .Where(x => x.Settings.ProcessLogOutput ?? ProcessTasks.DefaultLogOutput) .SelectMany(x => - x.Exception is not ProcessException processException - ? outputSelector(x.Result) - : processException.Process.Output) - .ForEach(x => logger(x.Type, x.Text)); + { + var (settings, result, exception) = x; + var output = exception switch + { + ProcessException processException => processException.Process.Output, + _ => outputSelector(result), + }; + + return output.Select(x => (Logger: settings.ProcessLogger, Line: x)); + }) + .ForEach(x => x.Logger(x.Line.Type, x.Line.Text)); } } }