Skip to content

Commit 4bd289a

Browse files
committed
fix: reduce one level promise
Windows seems to be hanging, hopefully this reduces the number of promises in the chain.
1 parent 607bac5 commit 4bd289a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/install.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async function install (fs, gyp, argv) {
188188
const installVersionPath = path.resolve(devDir, 'installVersion')
189189
await Promise.all([
190190
// need to download node.lib
191-
...(win ? [downloadNodeLib()] : []),
191+
...(win ? downloadNodeLib() : []),
192192
// write the "installVersion" file
193193
fs.promises.writeFile(installVersionPath, gyp.package.installVersion + '\n'),
194194
// Only download SHASUMS.txt if we downloaded something in need of SHA verification
@@ -228,10 +228,10 @@ async function install (fs, gyp, argv) {
228228
log.verbose('checksum data', JSON.stringify(expectShasums))
229229
}
230230

231-
async function downloadNodeLib () {
231+
function downloadNodeLib () {
232232
log.verbose('on Windows; need to download `' + release.name + '.lib`...')
233233
const archs = ['ia32', 'x64', 'arm64']
234-
return Promise.all(archs.map(async (arch) => {
234+
return archs.map(async (arch) => {
235235
const dir = path.resolve(devDir, arch)
236236
const targetLibPath = path.resolve(dir, release.name + '.lib')
237237
const { libUrl, libPath } = release[arch]
@@ -264,7 +264,7 @@ async function install (fs, gyp, argv) {
264264
}),
265265
fs.createWriteStream(targetLibPath)
266266
)
267-
}))
267+
})
268268
} // downloadNodeLib()
269269
} // go()
270270

test/test-download.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ test('download over http with proxy', (t) => {
9393
pserver.listen(port + 1, host, async () => {
9494
const gyp = {
9595
opts: {
96-
proxy: `http://${host}:${port + 1}`
96+
proxy: `http://${host}:${port + 1}`,
97+
noproxy: 'bad'
9798
},
9899
version: '42'
99100
}

0 commit comments

Comments
 (0)