From: Eric Wong Date: Fri, 15 Nov 2019 09:50:42 +0000 (+0000) Subject: spawn: which: allow embedded slash for relative path X-Git-Tag: v1.3.0~290 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=2df8cfd320dc9efdf3c2764b2c60ec457c1b024f;p=public-inbox.git spawn: which: allow embedded slash for relative path This makes the subroutine behave more like which(1) command and will make using spawn() in tests easier. --- diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index e2868a55..b946a663 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -178,7 +178,7 @@ unless (defined $vfork_spawn) { sub which ($) { my ($file) = @_; - return $file if index($file, '/') == 0; + return $file if index($file, '/') >= 0; foreach my $p (split(':', $ENV{PATH})) { $p .= "/$file"; return $p if -x $p;