summaryrefslogtreecommitdiff
path: root/dh_installman
diff options
context:
space:
mode:
Diffstat (limited to 'dh_installman')
-rwxr-xr-xdh_installman13
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)>