Inconsistent splitting behavior fix

This commit is contained in:
Danny McCormick 2019-07-25 14:18:57 -04:00
parent 035f3d68f7
commit e6ea2e057b
2 changed files with 12 additions and 0 deletions

View File

@ -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) {

View File

@ -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) {