]> Sergey Matveev's repositories - public-inbox.git/commitdiff
spawn: support absolute paths
authorEric Wong <e@80x24.org>
Sun, 10 Mar 2019 21:40:00 +0000 (21:40 +0000)
committerEric Wong <e@80x24.org>
Thu, 4 Apr 2019 09:13:58 +0000 (09:13 +0000)
cgit (and most other CGI executables) is not typically installed
for use via $PATH, so we'll need to support absolute paths to
run it.

lib/PublicInbox/Spawn.pm

index 8ea255af25caa34e167ea5b1ab522559b468bb7e..202cfcaebee7cba63ccabc68378dd3464754220e 100644 (file)
@@ -166,9 +166,9 @@ unless (defined $vfork_spawn) {
        *pi_fork_exec = *PublicInbox::SpawnPP::pi_fork_exec
 }
 
-# n.b. we never use absolute paths with this
 sub which ($) {
        my ($file) = @_;
+       return $file if index($file, '/') == 0;
        foreach my $p (split(':', $ENV{PATH})) {
                $p .= "/$file";
                return $p if -x $p;