-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feature Request: ExecShell #977
Comments
To take a step back: the motivation for this desire is that it's common practice (look even in our own repo!) to have two copies of a script, for example The We thought about adding similar behavior to Creating a new built-in task |
Would it make sense to add a property to Exec like |
❓ Open design question: What should the arguments to this task be? I see a decision point:
I lean toward the latter: a simpler implementation is more likely to be correct, and conversion is a point-in-time problem; we should provide a good way to deal with the long future. |
❓ Open design question: Is there an opportunity to combine this with #399 (direct |
Maybe |
Aside: I do not like the name Extension inference also seems unnecessary. Here's why:
This thus provides a portable cross-platform pattern: instead of platform-specific file-extensions, embrace convention: provide a I thus think that this issue is actually a duplicate of Issue #399. |
Thanks for taking this a step back and looking at the high level @rainersigwald
From my experience dealing with splitting, recombining command line arguments in the cli, avoiding a shell layer will make this problem simpler. 👍 for this
I would like to propose a 3rd option (very similar to option #2) which will create less indirection from a user perspective.
➕: Makes it very clear at the call site what will end up in my string[] args in main of my next program, Users don't need to worry about escaping, string[] args will be the exact strings put into the items I think the primary difference here is that Arguments is an item group. The intention is that whatever strings are put in there will be the exact argument array passed to the
This is very similar to Process.Start but would require that we develop escaping logic for every supported shell or put that onus on the user.
The extension inference you're referring to is only present on Windows AFAIK and IIRC is based on the PATHEXT environment variable. The Windows only piece is enough reason to need this feature, but I think the fact that the inferred extensions are based on an environment variable is very undesirable for creating reproducible, deterministic builds. The example you've given supposes that build has no extension, but what if build has the |
Do we have enough to make a choice here? If so, can we pick one and get an ETA to when we can get this in? |
To weigh somewhat on the "extensionless" scripts mentioned above, I don't think we should force our users down a specific convention in this case given the prevalent amount of evidence that people do, in fact, use the |
Throwing this up for discussion based on the conversations today around extension inference in exec.
Let's flesh out the requirements, and features this task should implement.
Extension Inference
From the migration perspective, extension inference is a must, and which extensions are inferred should be configurable via a semicolon delimited list passed as a task parameter (
InferredExtensions
?)Determining the first token in the passed in
Command
for this task, is a difficult but solved problem. We can take advantage of existing implementations of these algorithms.For breaking apart the input string array into tokens we can use the implementation in CoreFX that does this:
https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs#L437
After mutating the tokens, to recombine them into a single string for use by Process.Start, we can use the analog implementation of the above algorithm present in the cli:
https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.Cli.Utils/ArgumentEscaper.cs#L23
@rainersigwald @livarcocc @eerhardt @cdmihai @AndyGerlicher @Sarabeth-Jaffe-Microsoft
The text was updated successfully, but these errors were encountered: