-
Notifications
You must be signed in to change notification settings - Fork 696
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 init -n fails with opaque error message when git not installed #8478
Comments
Relevant code: cabal/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs Lines 178 to 186 in 55b4ed9
Should be easy to fix. Anyone? |
@ptkato care to make a patch? |
Should an error be thrown if git is not installed in this case? Then perhaps something like this would work: |
git is needed to retrieve the user name and user email information for the cabal file. Now, it's the most reliable way of getting such info for the non-interactive workflow. I'm torn if we should throw an error or not, I don't recall if such user info is mandatory, even if it is, I think an error would be out of proportion (what if the user doesn't want git installed?); we could instead throw a warning to make the user aware that the name and email could not be retrieved instead. |
We definitely don't want to fail (in any way) if git is not installed. A warning, perhaps, could be added, but I'm not big on that either: I think a warning is justified when something could go wrong, and it's not the case here. |
Perhaps simply an empty default value for user name and user email when git is not installed with a note instead of a warning? |
Yes, sorry, by warning I didn't really mean "warning", but what @BasLaa suggested instead. |
No, you’re good. I’m just thinking aloud. Empty default is fine. For the “note” idea: I’d be curious to see a sketch, but I’m open minded. |
I can give it a try this weekend. |
This has been merged, so this should be fine to close now. |
On a new machine with Cabal 3.8.1.0, I tried running
cabal init -n newapp
and got what appeared to be an uncaught exception:
git: readCreateProcessWithExitCode: posix_spawnp: does not exist (No such file or directory)
It took a little while to figure out, but the issue seems to be that I didn't have git installed.
Perhaps this case could be handled with a more helpful error message.
The text was updated successfully, but these errors were encountered: