]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
spawn: don't append to scalarrefs on stdout/stderr
authorEric Wong <e@80x24.org>
Mon, 13 Nov 2023 13:15:42 +0000 (13:15 +0000)
committerEric Wong <e@80x24.org>
Mon, 13 Nov 2023 21:55:01 +0000 (21:55 +0000)
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
t/spawn.t

index 849438bca47705b3b31a09f644f7a2f7fe75f535..9c6806906e7cbeca20fbf7c4d131f09ac2706f91 100644 (file)
@@ -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
        }
 }
 
index 3479b6b323fa79c5c6f5f309b2d23631611bb235..48f541b83678860f4db1a331f071dfb559f193d1 100644 (file)
--- 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');
 }