]> Sergey Matveev's repositories - public-inbox.git/commitdiff
spawn: fix compatibility with old Inline::C
authorEric Wong <e@yhbt.net>
Thu, 21 May 2020 05:12:46 +0000 (05:12 +0000)
committerEric Wong <e@yhbt.net>
Sat, 23 May 2020 18:07:37 +0000 (18:07 +0000)
Older versions of Inline (e.g. 0.53 in CentOS 7) did not accept
the `directory' parameter, so use conditional assignment to set
a default value on $ENV{PERL_INLINE_DIRECTORY}, instead.

lib/PublicInbox/Spawn.pm

index 785ea865c84eec013ba201e6941a61ce0dcbf359..888283d0d090af72eaf1fd7f1a05c867164957d8 100644 (file)
@@ -141,7 +141,7 @@ int pi_fork_exec(SV *redirref, SV *file, SV *cmdref, SV *envref, SV *rlimref,
 }
 VFORK_SPAWN
 
-my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} // (
+my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} //= (
                $ENV{XDG_CACHE_HOME} //
                ( ($ENV{HOME} // '/nonexistent').'/.cache' )
        ).'/public-inbox/inline-c';
@@ -155,7 +155,7 @@ if (defined $vfork_spawn) {
                my $f = "$inline_dir/.public-inbox.lock";
                open my $fh, '>', $f or die "failed to open $f: $!\n";
                flock($fh, LOCK_EX) or die "LOCK_EX failed on $f: $!\n";
-               eval 'use Inline C => $vfork_spawn, directory => $inline_dir';
+               eval 'use Inline C => $vfork_spawn';
                my $err = $@;
                flock($fh, LOCK_UN) or die "LOCK_UN failed on $f: $!\n";
                die $err if $err;