t: handle EOF in test_copy_bytes()

The test_copy_bytes() function claims to read up to N bytes, or until it gets EOF. But we never handle EOF in our loop, and a short input will cause perl to go into an infinite loop of read() getting zero bytes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 16, 2017 at 06:45 UTC f7f6dc340ed4eb2bddc41993e112f8f18fcc1598
1 file changed +1
t/test-lib-functions.sh
+1
@@ -999,6 +999,7 @@ test_copy_bytes () {
999 my $s;
1000 my $nread = sysread(STDIN, $s, $len);
1001 die "cannot read: $!" unless defined($nread);
1002 + last unless $nread;
1003 print $s;
1004 $len -= $nread;
1005 }