From 6e07def560b211d9a1a3221862e72b7aeb4a31b3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 19 Apr 2020 23:19:37 +0000 Subject: testcommon: spawn-aware system() and qx[] workalikes Barely noticeable on Linux, but this gives a 1-2% speedup on a FreeBSD 11.3 VM and lets us use built-in redirects rather than relying on /bin/sh. --- t/nntpd.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 't/nntpd.t') diff --git a/t/nntpd.t b/t/nntpd.t index 826e3f3d..66aa48f1 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -48,7 +48,7 @@ $ibx = PublicInbox::Inbox->new($ibx); my @cmd = ('-init', $group, $inboxdir, 'http://example.com/', $addr); push @cmd, "-V$version", '-Lbasic'; ok(run_script(\@cmd), 'init OK'); - is(system(qw(git config), "--file=$home/.public-inbox/config", + is(xsys(qw(git config), "--file=$home/.public-inbox/config", "publicinbox.$group.newsgroup", $group), 0, 'enabled newsgroup'); my $len; @@ -304,7 +304,8 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000 if ($INC{'Search/Xapian.pm'} && ($ENV{TEST_RUN_MODE}//2)) { skip 'Search/Xapian.pm pre-loaded (by t/run.perl?)', 1; } - my @of = `lsof -p $td->{pid} 2>/dev/null`; + my $rdr = { 2 => \(my $null) }; + my @of = xqx(['lsof', '-p', $td->{pid}], undef, $rdr); skip('lsof broken', 1) if (!scalar(@of) || $?); my @xap = grep m!Search/Xapian!, @of; is_deeply(\@xap, [], 'Xapian not loaded in nntpd'); -- cgit v1.2.3-24-ge0c7