On Thu, 02 May 2019 10:53:37 -0500, Andrew Daugherity wrote:

> I reported this to FreeBSD ports a couple months ago [2], and they
> provided a fix [3] which repairs the -oMan output, and makes that the
> default.  Their fix applies cleanly to the OpenBSD tree and works, but
> I have no idea why mandoc requires resetting $?.  (Also, their ToMan
> patch has a previously-included hunk for MANWIDTH=tty, but it doesn't
> seem to do anything for me?)

There problem is a missing waitpid() call, so $? is not actually
set.  Something like the following should be better, though I haven't
tested it yet.

 - todd

Index: gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm,v
retrieving revision 1.8
diff -u -p -u -r1.8 ToMan.pm
--- gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm  13 Feb 2019 
21:15:14 -0000      1.8
+++ gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToMan.pm  2 May 2019 
16:16:05 -0000
@@ -352,6 +352,9 @@ sub _filter_through_nroff {
        close $writer;
        $self->debug( "Done writing\n" );
 
+       # wait for it to exit
+       waitpid( $pid, 0 );
+
        # read any leftovers
        $done .= do { local $/; <$reader> };
        $self->debug( sprintf "Done reading. Output is %d bytes\n",

Reply via email to