You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you might know, correct quoting of arguments can be a nightmare. Nuke always adds double quotes when launching processes via ProcessTasks.StartShell which can lead to wrong arguments passed when launching a batch file on windows.
While I'm not sure about the overall impact of such a change, I think Nuke should not add double quotes on Windows. cmd.exe seem to handle things fine if you do not add any quotes around the overall command while it breaks actual quotes when you need pass arguments with spaces to your script.
Reproduction Steps
Nuke:
varbat=(RootDirectory/"test.bat");bat.WriteAllText(""" @echo off SET Arg1=%~1 echo Arg1=%Arg1% """);varcmdArgs=newArguments();cmdArgs.Add("{value}",RootDirectory/"with spaces");ProcessTasks.StartShell($"{bat}{cmdArgs.RenderForExecution()}").AssertWaitForExit();
Related docs for the option and the exact behavior. If we don't want to go for /s nuke would need to respect the special logic described and quote accordingly.
/S Modifies the treatment of string after /C or /K (see below)
...
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
Usage Information
8.1.2, net8.0, Windows
Description
As you might know, correct quoting of arguments can be a nightmare. Nuke always adds double quotes when launching processes via
ProcessTasks.StartShell
which can lead to wrong arguments passed when launching a batch file on windows.While I'm not sure about the overall impact of such a change, I think Nuke should not add double quotes on Windows.
cmd.exe
seem to handle things fine if you do not add any quotes around the overall command while it breaks actual quotes when you need pass arguments with spaces to your script.Reproduction Steps
Nuke:
This launches a command like
While a command line like this would deliver the expected result:
Expected Behavior
Actual Behavior
Regression?
No response
Known Workarounds
Could you help with a pull-request?
Yes
The text was updated successfully, but these errors were encountered: