cabal build fails with warning, return code 0 when failing to build dependency documentation
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
When calling `cabal build` on a project with:
- a dependency `some-lib` with malformatted haddock comments
- a `cabal.project` that asks for documentation to be built for all packages
the command fails pretty unclearly with a "Warning" and zero exit code.
**To Reproduce**
(I had a pretty messy concrete example, this is breaking it down to what
I believe is a minimal case, but I haven't actually verified this live.)
```
$ cd /src/some-lib
$ cabal v2-haddock
...
cabal: Failed to build documentation for some-lib-0.1
$ cd /src/main-proj
$ cat cabal.project.local
package *
documentation: true
$ cabal v2-build
In order, the following will be built (use -v for more details):
- some-lib-0.1 (lib:some-lib) (requires build)
- main-proj-0.1 (lib) (first run)
Starting some-lib-0.1 (all, legacy fallback)
Building some-lib-0.1 (all, legacy fallback)
Haddock some-lib-0.1 (all, legacy fallback)
Warning: Failed to build documentation for some-lib-0.1 (which is required by main-proj-0.1).
$ echo $?
0
```
**Expected behavior**
`cabal build` should fail explicitly with an error. I.e., output `Error: ` instead of `Warning: `, and exit with a non-zero code.
**System information**
- Operating system: macos
- cabal version 3.4.0.0
- ghc 8.10.2
Contributor guide
Assessment
This issue has not been assessed yet.