$VERSION = 1.00;
@ISA = qw(Exporter);
- @EXPORT = qw(setup_sigwarn
+ @EXPORT = qw(setup_sigwarn forkcheck_setup forkcheck_mainprocess
dep14_version_mangle
debiantags debiantag_old debiantag_new
server_branch server_ref
our $debugprefix;
our $debuglevel = 0;
+our $forkcheck_mainprocess;
+
+sub forkcheck_setup () {
+ $forkcheck_mainprocess = $$;
+}
+
+sub forkcheck_mainprocess () {
+ # You must have called forkcheck_setup or setup_sigwarn already
+ getppid != $forkcheck_mainprocess;
+}
+
sub setup_sigwarn () {
- our $sigwarn_mainprocess = $$;
+ forkcheck_setup();
$SIG{__WARN__} = sub {
- die $_[0] unless getppid == $sigwarn_mainprocess;
+ die $_[0] if forkcheck_mainprocess;
};
}
sub git_cat_file ($) {
my ($objname) = @_;
# => ($type, $data) or ('missing', undef)
+ # in scalar context, just the data
our ($gcf_pid, $gcf_i, $gcf_o);
if (!$gcf_pid) {
my @cmd = qw(git cat-file --batch);