Skip to content

Commit 9cdab4e

Browse files
committed
Download the full SDK using curl.exe for more robustness
The `https.get()` function seems to choke a bit on the full SDK, but `curl.exe` is here to save the day. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent aeb03c4 commit 9cdab4e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/downloader.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function unzip(
7777
}
7878
mkdirp(outputDirectory)
7979
return new Promise<void>((resolve, reject) => {
80-
https.get(url, res =>
80+
const handleStream = (res: Readable): void => {
8181
res
8282
.pipe(unzipper.Parse())
8383
.on('entry', entry => {
@@ -104,7 +104,19 @@ async function unzip(
104104
.on('error', reject)
105105
.on('finish', progress)
106106
.on('finish', resolve)
107-
)
107+
}
108+
109+
if (!streamEntries) {
110+
https.get(url, handleStream)
111+
} else {
112+
// `https.get()` seems to have performance problems that cause frequent
113+
// ECONNRESET problems with larger payloads. Let's (ab-)use Git for Windows'
114+
// `curl.exe` to do the downloading for us in that case.
115+
const curl = spawn('C:/Program Files/Git/mingw64/bin/curl.exe', [url])
116+
handleStream(curl.stdout)
117+
// eslint-disable-next-line no-console
118+
curl.stderr.on('data', chunk => console.log(`${chunk}`))
119+
}
108120
})
109121
}
110122

0 commit comments

Comments
 (0)