From e6ea2e057ba4a7f7ce1becd080def3a5c21287ca Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Thu, 25 Jul 2019 14:18:57 -0400 Subject: [PATCH] Inconsistent splitting behavior fix --- lib/installer.js | 5 +++++ src/installer.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/installer.js b/lib/installer.js index 19f608c..7fc9020 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -215,6 +215,7 @@ class DotnetCoreInstaller { if (downloadUrls.length == 0) { throw `Could not construct download URL. Please ensure that specified version ${version} is valid.`; } + core.debug(`Got download urls ${downloadUrls}`); return downloadUrls; }); } @@ -276,6 +277,10 @@ class DotnetCoreInstaller { let legacyUrl = ''; if (!!output && output.length > 0) { let lines = output.split(os.EOL); + // Fallback to \n if initial split doesn't work (not consistent across versions) + if (lines.length === 1) { + lines = output.split('\n'); + } if (!!lines && lines.length > 0) { lines.forEach((line) => { if (!line) { diff --git a/src/installer.ts b/src/installer.ts index 0ae3cf9..b282d60 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -232,6 +232,8 @@ export class DotnetCoreInstaller { throw `Could not construct download URL. Please ensure that specified version ${version} is valid.`; } + core.debug(`Got download urls ${downloadUrls}`); + return downloadUrls; } @@ -307,6 +309,11 @@ export class DotnetCoreInstaller { let legacyUrl: string = ''; if (!!output && output.length > 0) { let lines: string[] = output.split(os.EOL); + + // Fallback to \n if initial split doesn't work (not consistent across versions) + if (lines.length === 1) { + lines = output.split('\n'); + } if (!!lines && lines.length > 0) { lines.forEach((line: string) => { if (!line) {