Single-file scripts, invoked by absolute path outside of a package, fail on Windows
Open
cabal-install: cmd/run
platform: windows
re: scripts
type: bug
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Imagine that you have `#!/usr/bin/env cabal` script somewhere outside of a package, say, `C:\Foo.hs`. Now if the current folder is another, completely unrelated Cabal project and you execute `C:\Foo.hs`, it ends up calling `cabal run C:\Foo.hs` and tries to resolve it as component `\Foo.hs` of a package `C` in the current environment, which obviously fails.
Some relevant source code:
https://github.com/haskell/cabal/blob/a260cde00be9d0febd24dae958f7b45484249107/cabal-install/src/Distribution/Client/CmdRun.hs#L307-L331
Contributor guide
Assessment
This issue has not been assessed yet.