dotnet / dotnet/sdk

$(RunCommand) quoting

Open
#54,917 3 comments 0 reactions 0 assignees View on GitHub
Area-NetSDK Area-Run untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

Is `$(RunCommand)` supposed to be the path to an executable, or just a general shell-executed string to run?

This matters, because it determines whether `$(RunCommand)` must be quoted if it contains spaces (or other shell-interpreted characters).

The Run target uses MSBuild's Exec task:

https://github.com/dotnet/sdk/blob/b489ab2a02e2914ff70eb69736e96df1cb12a92f/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L1462-L1465

which means that according to this implementation, `$(RunCommand)` is a general shell-executed string, and if something needs quoting, the `$(RunCommand)` variable must contain those quotes.

However, `dotnet test` passes `$(RunCommand` directly to `Process.Start()`:

https://github.com/dotnet/sdk/blob/b489ab2a02e2914ff70eb69736e96df1cb12a92f/src/Cli/dotnet/Commands/Test/MTP/TestApplication.cs#L160

and if this is how it's supposed to be, then `$(RunCommand)` is the path to an executable on disk, and _must not be quoted_.

So which is it?

And then the wrong implementation would need to be updated to follow the spec.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the Run target in src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets and the Process.Start call in src/Cli/dotnet/Commands/Test/MTP/TestApplication.cs. Trace the expected $(RunCommand) contract and check related tests or documentation. Done means the quoting behavior is specified and both paths consistently follow it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.