use PublicInbox::Spawn qw(spawn);
my $usage = "Usage: public-inbox-compact REPO_DIR\n";
my $dir = shift or die $usage;
-my $config = PublicInbox::Config->new;
+my $config = eval { PublicInbox::Config->new };
my $ibx;
$dir = abs_path($dir);
-$config->each_inbox(sub {
- $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir
-});
+if ($config) {
+ $config->each_inbox(sub {
+ $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir
+ });
+}
unless ($ibx) {
warn "W: $dir not configured in ".
PublicInbox::Config::default_file() . "\n";
my $new_dir = shift or die $usage;
die "$new_dir exists\n" if -d $new_dir;
die "$old_dir not a directory\n" unless -d $old_dir;
-my $config = PublicInbox::Config->new;
+my $config = eval { PublicInbox::Config->new };
$old_dir = abs_path($old_dir);
my $old;
-$config->each_inbox(sub {
- $old = $_[0] if abs_path($_[0]->{mainrepo}) eq $old_dir;
-});
+if ($config) {
+ $config->each_inbox(sub {
+ $old = $_[0] if abs_path($_[0]->{mainrepo}) eq $old_dir;
+ });
+}
unless ($old) {
warn "W: $old_dir not configured in " .
PublicInbox::Config::default_file() . "\n";
}
local $ENV{PATH} = "blib/script:$ENV{PATH}";
+local $ENV{PI_CONFIG} = '/dev/null';
open my $err, '>>', "$tmpdir/err.log" or die "open: err.log $!\n";
open my $out, '>>', "$tmpdir/out.log" or die "open: out.log $!\n";
my $rdr = { 1 => fileno($out), 2 => fileno($err) };