-
Notifications
You must be signed in to change notification settings - Fork 841
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
Add executable fall-through #1434
Add executable fall-through #1434
Conversation
Updated to conform to 2 spaces indentation and not run |
mExternalExec <- Directory.findExecutable ("stack-" ++ head as) | ||
case mExternalExec of | ||
Just ex -> do | ||
ph <- spawnProcess ex (tail as) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if this replaces the current process instead of spawning a sub-process and just waiting for it to finish. Stack.Exec.exec
will do that, but it's another function that needs an EnvOverride (this time via a Config). It's possible to create an EnvOverride using System.Process.Read.mkEnvOverride
, and exec
could be modified to take an EnvOverride as an argument instead of needing a Config.
It seems like I'd still need a config to know the platform... I made some changes, but couldn't get this to work. |
Using Distrubition.System.buildPlatform will suffice for this case.
|
Cool, thanks for the tip; I should have asked sooner. Updated and rebased against Not sure if I made the |
Thanks, this is looking just about ready for merge. I tested it and everything seems to be in order. Please add an entry to the changelog, and maybe squash it into one commit. |
Okie, coolness! Squashed, changelog entry added and rebased against |
This closes #1433. When an invalid `stack` command is issued, `stack` will look in the `PATH` for a matching binary. So given there's an executable `stack-something` in the `PATH`, issuing `stack something` will execute it, rather than failing. It uses `System.Directory.findExecutable` to find executables and `exec` from `System.Process.Read` to execute the process. Adds a mOnFailure callback to be called on parser failures to the `Options.Complicated` parsing function.
…cutable-fallthrough Add executable fall-through
Uses
System.Directory.findExecutable
. Adds amOnInvalidArgs
callback to thecomplicatedOptions
function onOptions.Applicative.Complicated
the rest ofthe logic is centralized on
Main
.I didn't use
System.Process.Read.findExecutable
because I'd then needgetMinimalEnvOverride
, which would requireGlobalOpts
I think. I'm not sure,but I don't understand what'd give at the moment.
Will rebase after discussion.
This closes #1433.