]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
run update-copyrights from gnulib for 2019
[public-inbox.git] / lib / PublicInbox / Git.pm
index 6a87661c290faaa4ea0275f70a1fe23bf15898ba..d048051ea1e48479d0585ae2df04fa0a67aaa681 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
 # License: GPLv2 or later <https://www.gnu.org/licenses/gpl-2.0.txt>
 #
 # Used to read files from a git repository without excessive forking.
@@ -198,7 +198,10 @@ sub _destroy {
        my $p = delete $self->{$pid} or return;
        delete @$self{($in, $out)};
        delete $self->{$err} if $err; # `err_c'
-       waitpid $p, 0;
+
+       # PublicInbox::DS may not be loaded
+       eval { PublicInbox::DS::dwaitpid($p, undef, undef) };
+       waitpid($p, 0) if $@; # wait synchronously if not in event loop
 }
 
 sub fail {
@@ -303,7 +306,7 @@ sub modified ($) {
                chomp $oid;
                my $buf = cat_file($self, $oid) or next;
                $$buf =~ /^committer .*?> ([0-9]+) [\+\-]?[0-9]+/sm or next;
-               my $cmt_time = $1;
+               my $cmt_time = $1 + 0;
                $modified = $cmt_time if $cmt_time > $modified;
        }
        $modified || time;