diff options
author | Eric Wong <e@yhbt.net> | 2020-04-19 23:19:37 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-04-20 20:18:21 +0000 |
commit | 6e07def560b211d9a1a3221862e72b7aeb4a31b3 (patch) | |
tree | b6e3b54f928145b3f1c05bd5b0444f70f7eabd4f /t/ds-leak.t | |
parent | 47acfe0e9d09e907393465e155e114e8fdc5f5a1 (diff) | |
download | public-inbox-6e07def560b211d9a1a3221862e72b7aeb4a31b3.tar.gz |
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.
Diffstat (limited to 't/ds-leak.t')
-rw-r--r-- | t/ds-leak.t | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/t/ds-leak.t b/t/ds-leak.t index b29d814e..72bf0379 100644 --- a/t/ds-leak.t +++ b/t/ds-leak.t @@ -10,7 +10,7 @@ use PublicInbox::TestCommon; use_ok 'PublicInbox::DS'; if ('close-on-exec for epoll and kqueue') { - use PublicInbox::Spawn qw(spawn); + use PublicInbox::Spawn qw(spawn which); my $pid; my $evfd_re = qr/(?:kqueue|eventpoll)/i; @@ -31,10 +31,12 @@ if ('close-on-exec for epoll and kqueue') { my $l = <$r>; is($l, undef, 'cloexec works and sleep(1) is running'); - my @of = grep(/$evfd_re/, `lsof -p $pid 2>/dev/null`); - my $err = $?; SKIP: { - skip "lsof missing? (\$?=$err)", 1 if $err; + my $lsof = which('lsof') or skip 'lsof missing', 1; + my $rdr = { 2 => \(my $null) }; + my @of = grep(/$evfd_re/, xqx([$lsof, '-p', $pid], {}, $rdr)); + my $err = $?; + skip "lsof broken ? (\$?=$err)", 1 if $err; is_deeply(\@of, [], 'no FDs leaked to subprocess'); }; if (defined $pid) { |