fix: bug in Deno.copy (#4977)

This commit is contained in:
Marcos Casagrande 2020-04-29 03:30:48 +02:00 committed by GitHub
parent 640f6878f6
commit 0703431ec2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -65,7 +65,11 @@ export async function copy(
if (result === null) {
gotEOF = true;
} else {
n += await dst.write(b.subarray(0, result));
let nwritten = 0;
while (nwritten < result) {
nwritten += await dst.write(b.subarray(nwritten, result));
}
n += nwritten;
}
}
return n;