Skip to content

Commit

Permalink
Fix: race condition between WriteStream close and process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Janssen committed May 3, 2024
1 parent d48ecc6 commit 0a87690
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export function download(
});
res2.on('progress', progress);
res2.on('error', reject);
res2.on('end', resolve);
res2.on('end', () => {
w.on('close', () => {
resolve();
});
})
})
.on('error', reject);
})
Expand Down

0 comments on commit 0a87690

Please sign in to comment.