diff options
author | Niels Thykier <niels@thykier.net> | 2019-09-29 20:34:47 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2019-09-29 20:44:39 +0000 |
commit | 488e6310d5c512b12079f4b353c039deefca3dea (patch) | |
tree | 8c80d5cdb87cee53cebe9846feea476ec1a2bfd7 /dh_installman | |
parent | 92c016db6b82b36aca270ca2a269859e7a17f2cb (diff) | |
download | debhelper-488e6310d5c512b12079f4b353c039deefca3dea.tar.gz |
dh_installman: Avoid error messages when man-db is not present
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'dh_installman')
-rwxr-xr-x | dh_installman | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dh_installman b/dh_installman index f8de7ace..55a13fa5 100755 --- a/dh_installman +++ b/dh_installman @@ -272,7 +272,7 @@ on_items_in_parallel(\@all_packages, sub { }); # Now utf-8 conversion. -if (defined(`man --version`)) { +if (has_man_db_tool('man')) { my (@manpages_to_reencode, @issues); for my $package (@{$dh{DOPACKAGES}}) { next if is_udeb($package); @@ -359,6 +359,17 @@ sub find_so_man { } } +sub has_man_db_tool { + my ($tool) = @_; + open(my $old_stderr, '>&', *STDERR) or error("dup(STDERR, tmp_fd): $!"); + open(*STDERR, '>', '/dev/null') or error("re-open stderr as /dev/null: $!"); + + my $res = defined(`$tool --version`); + open(*STDERR, '>&', $old_stderr) or error("dup(tmp_fd, STDERR): $!"); + close($old_stderr); + return $res; +} + =head1 SEE ALSO L<debhelper(7)> |