From 2df8cfd320dc9efdf3c2764b2c60ec457c1b024f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 15 Nov 2019 09:50:42 +0000 Subject: 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. --- lib/PublicInbox/Spawn.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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; -- cgit v1.2.3-24-ge0c7