Follow-up Comment #2, bug #68733 (group groff): [comment #1 comment #1:]
> $ grep -n 'first_pass' contrib/mm/mmroff.pl
> 85:my $first_pass = "$groff -rRef=1 -z -mm @ARGV";
> 91:open(MACRO, "$first_pass 2>&1 |") || die "run $first_pass:$!";
> Looks like I need to figure out how to squeeze _groff_'s exit status out of
> that.
Good guess, but not quite out of _that._ :-D
Trying to save you from a wild goose chase by quoting from "perldoc -f open":
Closing any piped filehandle causes the parent process to
wait for the child to finish, then returns the status value
in $? and "${^CHILD_ERROR_NATIVE}".
And quoting from "perldoc -f close":
If the filehandle came from a piped open, "close" returns false if
one of the other syscalls involved fails or if its program exits
with non-zero status. If the only problem was that the program
exited non-zero, $! will be set to 0. Closing a pipe also waits
for the process executing on the pipe to exit--in case you wish to
look at the output of the pipe afterwards--and implicitly puts the
exit status value of that command into $? and
"${^CHILD_ERROR_NATIVE}".
That Perl manual page gives an example:
close OUTPUT # wait for sort to finish
or warn $! ? "Error closing sort pipe: $!" : "Exit status $? from
sort";
The geese you are looking for are hiding behind the close(MACRO); not behind
the open(MACRO, ...).
Hope that helps!
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68733>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
