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 5A0651F69D for ; Mon, 13 Nov 2023 13:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1699881354; bh=4rYp+UvahRUtm6Gze2ANwHJG5lMJvE4mJSsDwfYsXm4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=05VFyFRxqFeGxegMMjQwNv1KqIQVrHbIYcXC1d2nDVYNBco4keAwViVaTedA6JvqT v9DI2fAxnfS/eGWVdRVtMLdmCQ1eVm508pThonGJfxhlpX1/7gdoWxPO2SL4Tom80N 2wj5qHdbT8ovDA5lUttCAHBdoOo2f0Qm75pT3C/Y= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/18] spawn: don't append to scalarrefs on stdout/stderr Date: Mon, 13 Nov 2023 13:15:42 +0000 Message-Id: <20231113131551.843230-10-e@80x24.org> In-Reply-To: <20231113131551.843230-1-e@80x24.org> References: <20231113131551.843230-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: None of our current code relies on it, and I can't imagine it's something we'd need in the future, actually... This keeps the door open for relying more on Spawn in TestCommon. --- lib/PublicInbox/Spawn.pm | 2 +- t/spawn.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 849438bc..9c680690 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -401,7 +401,7 @@ sub read_out_err ($) { seek($fh, 0, SEEK_SET); my $dst = $opt->{$fd}; $dst = $opt->{$fd} = $dst->[1] if ref($dst) eq 'ARRAY'; - PublicInbox::IO::read_all $fh, 0, $dst, length($$dst); + PublicInbox::IO::read_all $fh, 0, $dst } } diff --git a/t/spawn.t b/t/spawn.t index 3479b6b3..48f541b8 100644 --- a/t/spawn.t +++ b/t/spawn.t @@ -26,7 +26,7 @@ require PublicInbox::DS; is($out, 'in', 'stdin read and stdout captured'); $opt->{0} = \"IN\n3\nLINES"; my @out = run_qx(['sh', '-c', 'echo E >&2; cat'], undef, $opt); - is($e, "e\nE\n", 'captured stderr appended to string'); + is($e, "E\n", 'captured stderr clobbers string'); is_deeply(\@out, [ "IN\n", "3\n", 'LINES' ], 'stdout array'); }