diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:38:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:36 +0000 |
commit | 3829004faab901fabbda922a1900842e51812ff0 (patch) | |
tree | 36da53721dfa2a0e4da90b4436c6fb629b363b4a /lib/PublicInbox/TestCommon.pm | |
parent | bb0ee9609077ca9e0c014af03fab91f57e4b9712 (diff) | |
download | public-inbox-3829004faab901fabbda922a1900842e51812ff0.tar.gz |
It's not lei-specific since we have `-C' to perform chdir for multiple admin commands.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 96663731..5ad12942 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -15,7 +15,7 @@ use Carp (); our @EXPORT; my $lei_loud = $ENV{TEST_LEI_ERR_LOUD}; my $tail_cmd = $ENV{TAIL}; -our ($lei_opt, $lei_out, $lei_err, $lei_cwdfh); +our ($lei_opt, $lei_out, $lei_err); use autodie qw(chdir close fcntl open opendir seek unlink); $_ = File::Spec->rel2abs($_) for (grep(!m!^/!, @INC)); @@ -410,15 +410,12 @@ sub run_script ($;$$) { local $SIG{FPE} = 'IGNORE'; # Perl default local $0 = join(' ', @$cmd); my $orig_io = _prepare_redirects($fhref); - my $cwdfh = $lei_cwdfh; - if (my $d = $opt->{'-C'}) { - $cwdfh or opendir $cwdfh, '.'; - chdir $d; - } + opendir(my $cwdfh, '.'); + chdir $opt->{-C} if defined $opt->{-C}; _run_sub($sub, $key, \@argv); # n.b. all our uses of PublicInbox::DS should be fine # with this and we can't Reset here. - chdir($cwdfh) if $cwdfh; + chdir($cwdfh); _undo_redirects($orig_io); select STDOUT; umask($umask); @@ -672,9 +669,7 @@ sub test_lei { SKIP: { my ($cb) = pop @_; my $test_opt = shift // {}; - local $lei_cwdfh; use autodie qw(mkdir); - opendir $lei_cwdfh, '.'; require_git(2.6, 1); my $mods = $test_opt->{mods} // [ 'lei' ]; require_mods(@$mods, 2); |