From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 93B031F47A for ; Sat, 7 Oct 2023 21:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1696713850; bh=g0vkDtVYEsfli/uy6RZ8gy9wRaPwcQUWgl2G9hB8PFE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qsbuMv+zyxX3TvZCN/b+qxzBCkUQe6YM7T8cIIY/ArUwRGsq+6UIvs0GFeXfSs08u rRdT9aGs7tXindHbkxhTq0qV9verC76+YcYIHIijninchlcs/tcHW+mxKsShZ9sSNX YPL9Bvk4sGe7IOzGldwDrbibEn49egefLzsrCwlo= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/9] xt/httpd-async-stream: avoid waitpid call Date: Sat, 7 Oct 2023 21:24:02 +0000 Message-ID: <20231007212410.297785-2-e@80x24.org> In-Reply-To: <20231007212410.297785-1-e@80x24.org> References: <20231007212410.297785-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(-) 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; };