From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E453E1FC0C for ; Tue, 9 Feb 2021 08:09:38 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/11] t/run.perl: drop Cwd dependency Date: Tue, 9 Feb 2021 07:09:35 -0100 Message-Id: <20210209080937.4678-10-e@80x24.org> In-Reply-To: <20210209080937.4678-1-e@80x24.org> References: <20210209080937.4678-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Perl 5.8.8/5.10.0+ can use fchdir(), and we depend on 5.10.1+ --- t/run.perl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/t/run.perl b/t/run.perl index d0b29e68..e8512e18 100755 --- a/t/run.perl +++ b/t/run.perl @@ -14,7 +14,6 @@ use strict; use v5.10.1; use IO::Handle; # ->autoflush use PublicInbox::TestCommon; -use Cwd qw(getcwd); use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); use Errno qw(EINTR); use Fcntl qw(:seek); @@ -33,7 +32,7 @@ if (($ENV{TEST_RUN_MODE} // 2) == 0) { die "$0 is not compatible with TEST_RUN_MODE=0\n"; } my @tests = scalar(@ARGV) ? @ARGV : glob('t/*.t'); -my $cwd = getcwd(); +open my $cwd_fh, '<', '.' or die "open .: $!"; open my $OLDOUT, '>&STDOUT' or die "dup STDOUT: $!"; open my $OLDERR, '>&STDERR' or die "dup STDERR: $!"; $OLDOUT->autoflush(1); @@ -64,7 +63,7 @@ our ($worker, $worker_test); sub test_status () { $? = 255 if $? == 0 && !$tb->is_passing; my $status = $? ? 'not ok' : 'ok'; - chdir($cwd) or DIE "chdir($cwd): $!"; + chdir($cwd_fh) or DIE "fchdir: $!"; if ($log_suffix ne '') { my $log = $worker_test; $log =~ s/\.t\z/$log_suffix/;