From 96787c294d7a089d2f72fae3da59c75d257542fc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 7 Oct 2023 21:24:02 +0000 Subject: xt/httpd-async-stream: avoid waitpid call We can just use the non-wantarray form of popen_rd to save us some extra error checking. --- xt/httpd-async-stream.t | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'xt') diff --git a/xt/httpd-async-stream.t b/xt/httpd-async-stream.t index 0658c691..904f2ae9 100644 --- a/xt/httpd-async-stream.t +++ b/xt/httpd-async-stream.t @@ -58,7 +58,7 @@ my $do_get_all = sub { my ($buf, $nr); my $bytes = 0; my $t0 = now(); - my ($rd, $pid) = popen_rd([$curl, @CURL_OPT, $url]); + my $rd = popen_rd([$curl, @CURL_OPT, $url]); while (1) { $nr = sysread($rd, $buf, 65536); last if !$nr; @@ -67,9 +67,7 @@ my $do_get_all = sub { } my $res = $dig->hexdigest; my $elapsed = sprintf('%0.3f', now() - $t0); - close $rd or die "close curl failed: $!\n"; - waitpid($pid, 0) == $pid or die "waitpid failed: $!\n"; - $? == 0 or die "curl failed: $?\n"; + close $rd or die "close curl failed: $! \$?=$?\n"; print STDERR "# $job $$ ($?) $res (${elapsed}s) $bytes bytes\n"; $res; }; -- cgit v1.2.3-24-ge0c7