nuke icon indicating copy to clipboard operation
nuke copied to clipboard

Cannot suppress logging when using `DotNetTasks.DotNetToolUninstall` and `CombineWith`

Open sfwester opened this issue 2 years ago • 1 comments

Usage Information

7.0.6 / 8.0.100-rc.2.23502.2 / net8.0 / Windows 11

Description

When running DotNetTasks.DotNetToolUninstal using CombineWith it seems that DisableProcessLogOutput is ignored and the output is still printed.

When not using CombineWith the logs are properly suppressed.

Reproduction Steps

// output is not suppressed
var packageIds = new string[]
{
    "package",
};

DotNetTasks.DotNetToolUninstall(x => x
    .DisableProcessAssertZeroExitCode()
    .DisableProcessLogOutput()
    .SetGlobal(true)
    .CombineWith(packageIds, (s, id) => s
        .SetPackageName(id)),
    degreeOfParallelism: packageIds.Length,
    completeOnFailure: true);

// output is suppressed
DotNetToolUninstall(x => x
    .DisableProcessAssertZeroExitCode()
    .DisableProcessLogOutput()
    .SetGlobal(true)
    .SetPackageName("package"));

Expected Behavior

14:26:28 [INF] > /usr/bin/dotnet tool uninstall package --global
14:26:28 [INF] > /usr/bin/dotnet tool uninstall package --global

Actual Behavior

14:26:28 [INF] > /usr/bin/dotnet tool uninstall package --global
14:26:28 [ERR] A tool with the package Id 'package' could not be found. 
14:26:28 [ERR] 
14:26:28 [ERR] Tools are uninstalled using their package Id which may be different 
14:26:28 [ERR] from the tool name you use when calling the tool. You can find the tool names 
14:26:28 [ERR] and the corresponding package Ids for installed tools using the command
14:26:28 [ERR] 'dotnet tool list'.
14:26:28 [INF] > /usr/bin/dotnet tool uninstall package --global

Regression?

I thought it was working in a .net7 build but I went back and tested, and it seemed to be broken there as well. Maybe an older version of Nuke was working. I can try and track that down if need be.

Known Workarounds

No response

Could you help with a pull-request?

No

sfwester avatar Nov 14 '23 14:11 sfwester

https://github.com/nuke-build/nuke/pull/1263

matkoch avatar Jan 14 '24 23:01 matkoch