]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Spawn.pm
cleanup pure Perl use
[public-inbox.git] / lib / PublicInbox / Spawn.pm
index 3f69108a094d3dc1e61aa667927edbdf232ec7f9..7f61d8db54cf6bec9daa1cd83b38eeade23f96b3 100644 (file)
@@ -268,13 +268,14 @@ void recv_cmd4(PerlIO *s, SV *buf, STRLEN n)
 #endif /* defined(CMSG_SPACE) && defined(CMSG_LEN) */
 ALL_LIBC
 
-       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';
        warn "$inline_dir exists, not writable\n" if -e $inline_dir && !-w _;
        $all_libc = undef unless -d _ && -w _;
        if (defined $all_libc) {
+               local $ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
                my $f = "$inline_dir/.public-inbox.lock";
                open my $oldout, '>&', \*STDOUT or die "dup(1): $!";
                open my $olderr, '>&', \*STDERR or die "dup(2): $!";
@@ -302,7 +303,9 @@ EOM
                        $all_libc = undef;
                }
        }
-       unless ($all_libc) {
+       if (defined $all_libc) { # set for Gcf2
+               $ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
+       } else {
                require PublicInbox::SpawnPP;
                *pi_fork_exec = \&PublicInbox::SpawnPP::pi_fork_exec
        }