Skip to content

Problem calling Tool with two AbsolutePath's containing spaces. #1376

Closed
@bitzer-sbc

Description

@bitzer-sbc

Usage Information

Nuke 8.0.0 / SDK 8.0.200 / Net8.0 / Windows 10 Pro 22H2

Description

I have many Nuke scripts where this works with Tools like Git.
But in this particular case, I use a Tool instantiated with ToolResolver.GetTool, and it gets the parameters all wrong.

Reproduction Steps

My Build project is in a path with spaces in one directory name (C:\projects\Nuke test). In real life the tool is an exe we built ourselves, but for the demo, I use xcopy.exe as a Tool and have the following code:

        Tool xcopy = ToolResolver.GetTool((AbsolutePath)@"C:" / "Windows" / "System32" / "xcopy.exe");
        xcopy($"{RootDirectory / "test.ps1"} {RootDirectory / "test.ps2"}");

Expected Behavior

I would expect Nuke to call:
C:\Windows\System32\xcopy.exe "C:\projects\Nuke Test\test.ps1" "C:\projects\Nuke Test\test.ps2"

Actual Behavior

Nuke calls
C:\Windows\System32\xcopy.exe C:\projects\Nuke Test\test.ps1" "C:\projects\Nuke Test\test.ps2

Nuke.Common.Tooling.ProcessException: Process 'xcopy.exe' exited with code 4.

C:\Windows\System32\xcopy.exe C:\projects\Nuke Test\test.ps1" "C:\projects\Nuke Test\test.ps2
@ C:\projects\Nuke Test
Error output:
Invalid number of parameters

Regression?

I don't know, but I often use Tool with paths including spaces, just not from ToolResolver.GetTool()

Known Workarounds

No response

Could you help with a pull-request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions