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,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 46BE31FA4D for ; Thu, 9 Nov 2023 10:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1699524589; bh=NXhqDstFyYH0OGOi3m/VXwDluQD/tQR8Y8jxApMqg+s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OQ5pasm3X7VQJdI7x4IyhBt+FCgeGCD6cizss/ImlvP/EFVa4VoB7SH7Bn26SGK9T QeFsI3obPonYTqdh6nnrzKkK/idG4M4RkmWXxDVMoAfTB7pnOjN5JlRTQQVNnCNUG1 vYJWIV1b2QcRGAqyXUkDCpItgSvZ6JX0Z5nyxmuM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 13/13] spawn: get rid of wantarray popen_rd/popen_wr Date: Thu, 9 Nov 2023 10:09:46 +0000 Message-ID: <20231109100946.1440611-14-e@80x24.org> In-Reply-To: <20231109100946.1440611-1-e@80x24.org> References: <20231109100946.1440611-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We've updated all of our users to use Process::IO (and avoiding tied handles) so the trade-off for using the array context no longer exists. --- lib/PublicInbox/Spawn.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 8c798b39..8cc4dfaf 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -384,16 +384,14 @@ sub spawn ($;$$) { sub popen_rd { my ($cmd, $env, $opt, @cb_arg) = @_; pipe(my $r, local $opt->{1}); - my $pid = spawn($cmd, $env, $opt); - wantarray ? ($r, $pid) : PublicInbox::IO::attach_pid($r, $pid, @cb_arg) + PublicInbox::IO::attach_pid($r, spawn($cmd, $env, $opt), @cb_arg); } sub popen_wr { my ($cmd, $env, $opt, @cb_arg) = @_; pipe(local $opt->{0}, my $w); $w->autoflush(1); - my $pid = spawn($cmd, $env, $opt); - wantarray ? ($w, $pid) : PublicInbox::IO::attach_pid($w, $pid, @cb_arg) + PublicInbox::IO::attach_pid($w, spawn($cmd, $env, $opt), @cb_arg); } sub read_out_err ($) {