forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly piping into `man -l -` does not work as BSD-`man` does not understand option `-l`. More standardized are the building blocks `nroff` and `less`. `cabal man` now should behave as pipeline ``` cabal man --raw | nroff -man /dev/stdin | less ``` Also fixed output of `cabal man --raw` so that it does not produce warnings. - `.R` removed. Was warning: ``` `R' is a string (producing the registered sign), not a macro. ``` - No quoted 'new-FOO' should appear at beginning of line. Was warning: ``` warning: macro `new-FOO'' not defined (probably missing space after `ne') ``` Added to `cabal-testsuite/PackageTests/Man/cabal.test.hs` a check that the `stderr` output of `nroff -man /dev/stdin` is empty (no warnings). Remaining problem: Unfortunately, after quitting `less` with `q` the following error is displayed: ``` fd:NNN: commitBuffer: resource vanished (Broken pipe) ``` Not sure how to fix this (my attempts failed).
- Loading branch information
1 parent
96ea35d
commit e5b148b
Showing
3 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
import System.Process | ||
import Test.Cabal.Prelude | ||
|
||
|
||
main = cabalTest $ do | ||
r <- cabal' "man" ["--raw"] | ||
assertOutputContains ".B cabal install" r | ||
assertOutputDoesNotContain ".B cabal manpage" r | ||
|
||
-- Check that output of `cabal man --raw` can be passed through `nroff -man` | ||
-- without producing any warnings (which are printed to stderr). | ||
-- | ||
-- NB: runM is not suitable as it mixes stdout and stderr | ||
-- r2 <- runM "nroff" ["-man", "/dev/stdin"] $ Just $ resultOutput r | ||
(ec, _output, errors) <- liftIO $ | ||
readProcessWithExitCode "nroff" ["-man", "/dev/stdin"] $ resultOutput r | ||
unless (null errors) $ | ||
assertFailure $ unlines | ||
[ "Error: unexpected warnings produced by `nroff -man`:" | ||
, errors | ||
] |