summaryrefslogtreecommitdiff
path: root/cli/js/io.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2020-04-29 03:30:48 +0200
committerGitHub <noreply@github.com>2020-04-28 21:30:48 -0400
commit0703431ec23efbde59669cc0568ec740909e47d7 (patch)
treec4de3bd13cb5ac3032dfbd1eb265430391f5d8bb /cli/js/io.ts
parent640f6878f61204bf7211cd9f0750b3ab6dee57b8 (diff)
fix: bug in Deno.copy (#4977)
Diffstat (limited to 'cli/js/io.ts')
-rw-r--r--cli/js/io.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/js/io.ts b/cli/js/io.ts
index 72c90d047..bf86d55b1 100644
--- a/cli/js/io.ts
+++ b/cli/js/io.ts
@@ -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;