diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-24 15:33:35 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-24 15:33:35 +0100 |
commit | d7f4711321fc48529ad2d8999cace69a8e1314d5 (patch) | |
tree | 9ed90f08e0d92996062ce37807a214ada604ce99 /editors | |
parent | 81fa00c5b5d5ffb559a39c7ff5190a2519a8ea61 (diff) | |
parent | 74ed42c8e9057bdd8910d0eba03ea0b30b87e660 (diff) |
Merge #5841
5841: Gate stream.pipeline workaround on fixed versions of node r=matklad a=Veetaha
Fixes the symptom of https://github.com/cdr/code-server/issues/1810
Original report here: https://github.com/rust-analyzer/rust-analyzer/issues/3167#issuecomment-678390564
Thanks to @hjfreyer for precise investigation :D
Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/net.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts index 681eaa9c9..5eba2728d 100644 --- a/editors/code/src/net.ts +++ b/editors/code/src/net.ts | |||
@@ -134,6 +134,14 @@ async function downloadFile( | |||
134 | 134 | ||
135 | await pipeline(srcStream, destFileStream); | 135 | await pipeline(srcStream, destFileStream); |
136 | 136 | ||
137 | // Don't apply the workaround in fixed versions of nodejs, since the process | ||
138 | // freezes on them, the process waits for no-longer emitted `close` event. | ||
139 | // The fix was applied in commit 7eed9d6bcc in v13.11.0 | ||
140 | // See the nodejs changelog: | ||
141 | // https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V13.md | ||
142 | const [, major, minor] = /v(\d+)\.(\d+)\.(\d+)/.exec(process.version)!; | ||
143 | if (+major > 13 || (+major === 13 && +minor >= 11)) return; | ||
144 | |||
137 | await new Promise<void>(resolve => { | 145 | await new Promise<void>(resolve => { |
138 | destFileStream.on("close", resolve); | 146 | destFileStream.on("close", resolve); |
139 | destFileStream.destroy(); | 147 | destFileStream.destroy(); |