- $xtmp = undef;
-}
-
-# slightly easier-to-manage manage than END{} blocks
-package PublicInbox::Xtmpdirs;
-use strict;
-use warnings;
-use File::Path qw(remove_tree);
-
-sub setup_signals () {
- # http://www.tldp.org/LDP/abs/html/exitcodes.html
- $SIG{INT} = sub { exit(130) };
- $SIG{HUP} = $SIG{PIPE} = $SIG{TERM} = sub { exit(1) };
-}
-
-sub new {
- bless { '' => $$ }, $_[0]; # old shard => new (WIP) shard
-}
-
-sub DESTROY {
- my ($self) = @_;
- my $owner_pid = delete($self->{''}) or return;
- return if $owner_pid != $$;
- foreach my $new (values %$self) {
- defined $new or next; # may be undef if resharding
- remove_tree($new) unless -d "$new/old";
- }