Reject promise when https.get fails. Fix #49

This commit is contained in:
Pine Wu 2019-10-31 14:26:58 -07:00
Родитель ff61af079c
Коммит 487a134ea8
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -71,18 +71,20 @@ async function downloadVSCodeArchive(version: DownloadVersion): Promise<string>
outStream.on('close', () => {
resolve(archivePath);
});
https.get(archiveRequestOptions, res => {
res.pipe(outStream);
});
}).on('error', e => reject(e));
} else {
const zipPath = path.resolve(vscodeTestDir, `vscode-${version}.tgz`);
const outStream = fs.createWriteStream(zipPath);
https.get(archiveRequestOptions, res => {
res.pipe(outStream);
});
outStream.on('close', () => {
resolve(zipPath);
});
https.get(archiveRequestOptions, res => {
res.pipe(outStream);
}).on('error', e => reject(e));
}
});
});