diff --git a/src/vs/platform/node/zip.ts b/src/vs/platform/node/zip.ts index d84133cb68d13b6ad37a3c096d9a5bd0cead40c8..af8243dc3a350edaa1d03ef6408e097c89925c6e 100644 --- a/src/vs/platform/node/zip.ts +++ b/src/vs/platform/node/zip.ts @@ -93,11 +93,15 @@ function extractEntry(stream: Readable, fileName: string, mode: number, targetPa return; } - istream = createWriteStream(targetFileName, { mode }); - istream.once('close', () => c(null)); - istream.once('error', e); - stream.once('error', e); - stream.pipe(istream); + try { + istream = createWriteStream(targetFileName, { mode }); + istream.once('close', () => c(null)); + istream.once('error', e); + stream.once('error', e); + stream.pipe(istream); + } catch (error) { + e(error); + } })); } @@ -148,14 +152,14 @@ function extractZip(zipfile: ZipFile, targetPath: string, options: IOptions, log // directory file names end with '/' if (/\/$/.test(fileName)) { const targetFileName = path.join(targetPath, fileName); - last = createCancelablePromise(token => mkdirp(targetFileName, void 0, token).then(() => readNextEntry(token))); + last = createCancelablePromise(token => mkdirp(targetFileName, void 0, token).then(() => readNextEntry(token)).then(null, e)); return; } const stream = ninvoke(zipfile, zipfile.openReadStream, entry); const mode = modeFromEntry(entry); - last = createCancelablePromise(token => throttler.queue(() => stream.then(stream => extractEntry(stream, fileName, mode, targetPath, options, token).then(() => readNextEntry(token))))); + last = createCancelablePromise(token => throttler.queue(() => stream.then(stream => extractEntry(stream, fileName, mode, targetPath, options, token).then(() => readNextEntry(token)))).then(null, e)); }); }); }