Skip to content

Commit

Permalink
Fix backup downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny McCormick committed Aug 6, 2019
1 parent 401832e commit 552489c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,18 @@ function acquireNodeFromFallbackLocation(version) {
exeUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;
const exePath = yield tc.downloadTool(exeUrl);
yield io.mv(exePath, path.join(tempDir, 'node.exe'));
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = yield tc.downloadTool(libUrl);
yield io.mv(libPath, path.join(tempDir, 'node.lib'));
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
}
catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/node.lib`;
const exePath = yield tc.downloadTool(exeUrl);
yield io.mv(exePath, path.join(tempDir, 'node.exe'));
yield io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = yield tc.downloadTool(libUrl);
yield io.mv(libPath, path.join(tempDir, 'node.lib'));
yield io.cp(libPath, path.join(tempDir, 'node.lib'));
}
else {
throw err;
Expand Down
8 changes: 4 additions & 4 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,18 @@ async function acquireNodeFromFallbackLocation(
libUrl = `https://nodejs.org/dist/v${version}/win-${os.arch()}/node.lib`;

const exePath = await tc.downloadTool(exeUrl);
await io.mv(exePath, path.join(tempDir, 'node.exe'));
await io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = await tc.downloadTool(libUrl);
await io.mv(libPath, path.join(tempDir, 'node.lib'));
await io.cp(libPath, path.join(tempDir, 'node.lib'));
} catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
exeUrl = `https://nodejs.org/dist/v${version}/node.exe`;
libUrl = `https://nodejs.org/dist/v${version}/node.lib`;

const exePath = await tc.downloadTool(exeUrl);
await io.mv(exePath, path.join(tempDir, 'node.exe'));
await io.cp(exePath, path.join(tempDir, 'node.exe'));
const libPath = await tc.downloadTool(libUrl);
await io.mv(libPath, path.join(tempDir, 'node.lib'));
await io.cp(libPath, path.join(tempDir, 'node.lib'));
} else {
throw err;
}
Expand Down

0 comments on commit 552489c

Please sign in to comment.