Hi DJ Chase, On 8/2/22 17:51, DJ Chase wrote:
On Tue Aug 2, 2022 at 5:55 AM EDT, Alejandro Colomar wrote:The thing is that I'm running mandoc(1) from a Makefile, which means that not only stdout/stderr is important, but also the exit status. There's no trivial way to ignore mandoc(1)'s error code for certain warnings. Also, I run it for a few thousands of manual pages, so I don't want make(1) to stop at every page that triggers an unwanted warning. But I do want make(1) to stop at errors/warnings in general.You could swap mandoc’s stderr and stdout, then filter it with sed and redirect sed to stderr: mandoc -W <level> 3>&2 2>&1 1>&3 | sed '/reg/ex/d' >&2 Of course if mandoc also normally writes to stdout this would create new stuff on stderr, so you could run it in two-passes: # pass where we care about mandoc’s regular output mandoc 2>/dev/null # pass where we care about mandoc’s errors mandoc -W <level> 2>&1 >/dev/null | sed '/reg/ex/d' >&2 (https://stackoverflow.com/questions/13299317/)
mandoc(1) seems to always write to stdout in -Tlint mode, so this wouldn't be an issue.
The issue is the EXIT STATUS. Anything non-zero makes make(1) stop running and error with 2. That's the hardest thing to workaround.
Cheers, Alex
Cheers,
-- Alejandro Colomar <http://www.alejandro-colomar.es/>
OpenPGP_signature
Description: OpenPGP digital signature