-
Notifications
You must be signed in to change notification settings - Fork 698
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
cabal test
sees the executable, but cabal run
does not.
#8391
Comments
So is the underlying bug that |
Or, from another angle, is |
This is an excellent point. To me, it would be surprising if it wasn't.
I'd always assumed from the name that it's just for build tools. But the user guide states that it also makes executables available at run time. And does not make any qualifications about It's too late to change the behaviour of adding to Perhaps the best fix here is to:
|
Why not just make it available in the PATH in |
I'm not totally against it. But as @Mikolaj alluded to, it seems desirable to have |
IIRC |
I thought those were still compiled (even after #7851)? I've always wanted them to (at least have the option to) go through the interpreter, but I don't remember seeing anything about it in release notes. |
You may be right. There were recent great contributions preventing them from being compiled anew each time they are executed, etc., etc., so I thought they may have been compiled to bytecode or interpreted beforehand. I'm not sure about any of that, but what I'm interested in in this context is whether they are executed in a somehow modified environment or not. There's also |
My understanding is that scripts are still compiled to native, but the build artifacts are cached now (just like with "normal" packages). GHC recently added a |
Thank you. That would imply that https://cabal.readthedocs.io/en/latest/cabal-commands.html?highlight=exec#cabal-exec Am I reading this right? Brings exes into scope? Would |
it isn't equivalent. A package with data files will not run with If we want to support #6919 then the variable will have to stay, otherwise we could compile directly with local paths |
makes sense to me. after all |
OK, I'm convinced. Could we document all this, probably most under https://cabal.readthedocs.io/en/latest/cabal-commands.html?highlight=cabal%20run#cabal-run? In particular, "cabal run sets an environment variable" and, after the addition, "makes build-tool-depends available in the PATH"? |
Related: #5411 |
Hi, I would like to try fix this. 🙂 The motivation is HLS which has tests that need to run the binary in separate process. The built HLS binary needs to be on path, otherwise I would need to pass it through environment variable manually. Looking at the code, it seems cabal exec $(cabal list-bin func-test) -- -p indefinite # this puts built HLS on path I could not find where the |
There is a package called
fourmolu
that is going to be my example here. The relevant issue is fourmolu/fourmolu#231. The appropriate commit is 12af899611cea08c5d9a1f547d432edfbce38be4 — the currentmain
.See for yourself:
Remove all instances of
fourmolu
on the path. You should have this:See that the tests pass:
See that the tests fail if run with
cabal run
:See that the tests pass if run with
cabal run
aftercabal install
:Expected:
Either the tests fail, or the tests pass. It does not matter which way I run them. In particular, Cabal makes the same executables available in the same way: either the
fourmolu
executable is made available to bothcabal run
andcabal test
or to neither.Actual:
The executable
fourmolu
is made available to the test programs when they are run withcabal test
but not withcabal run
.System information:
The text was updated successfully, but these errors were encountered: