@ISA = qw(Exporter);
@EXPORT = qw(setup_sigwarn
debiantag server_branch server_ref
- stat_exists fail ensuredir waitstatusmsg failedcmd
+ stat_exists fail ensuredir executable_on_path
+ waitstatusmsg failedcmd
cmdoutput cmdoutput_errok
git_rev_parse git_get_ref git_for_each_ref
git_for_each_tag_referring is_fast_fwd
die "mkdir $dir: $!";
}
+sub executable_on_path ($) {
+ my ($program) = @_;
+ return 1 if $program =~ m{/};
+ my @path = split /:/, ($ENV{PATH} // "/usr/local/bin:/bin:/usr/bin");
+ foreach my $pe (@path) {
+ my $here = "$pe/$program";
+ return $here if stat_exists $here && -x _;
+ }
+ return undef;
+}
+
our @signames = split / /, $Config{sig_name};
sub waitstatusmsg () {