-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProcessTasks.StartShell should not add quotes on windows. #1448
Comments
Some other things I noticed: Things might be tricky when the launched application also has spaces. What seems to work really as expected is:
Something like this should deliver the expected result: public static IProcess StartShell(
string command,
string? workingDirectory = null,
IReadOnlyDictionary<string, string>? environmentVariables = null,
int? timeout = null,
bool? logOutput = null,
bool? logInvocation = null,
Action<OutputType, string>? logger = null,
Func<string, string>? outputFilter = null)
{
return ProcessTasks.StartProcess(
toolPath: ToolPathResolver.GetPathExecutable(IsWin ? "cmd" : "bash"),
arguments: IsWin ? $"/s /c \"{command}\"" : $"-c {command.DoubleQuote()}",
workingDirectory,
environmentVariables,
timeout,
logOutput,
logInvocation,
logger,
outputFilter);
} Related docs for the option and the exact behavior. If we don't want to go for
|
The same seems to be true for |
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: