Skip to content

cabal init crashes if git is not installed #10484

Closed
@noiioiu

Description

@noiioiu

Describe the bug
Running cabal init without git installed results in the following error:

git: readCreateProcessWithExitCode: execvp: does not exist (No such file or directory)

or

git: readCreateProcessWithExitCode: posix_spawnp: does not exist (No such file or directory)

To Reproduce
Run cabal init in an empty directory on a system without git installed or after setting $PATH to something that includes cabal and ghc but not git. Answer the prompts; the program will exit with the above error message after you choose a license.

Expected behavior
cabal init should continue running and ask for author name, email address, etc.

System information

  • cabal 3.10.3.0, ghc 9.6.5 on NixOs 24.05
  • cabal 3.12.1.0, ghc 9.6.6 on OpenBSD 7.6-current

Additional context
The function Distribution.Client.Init.NonInteractive.Heuristics.guessGitInfo uses readProcessWithExitCode, which throws an IOError which should be caught if the file is not found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions