Skip to content

Commit e6ea2e0

Browse files
author
Danny McCormick
committed
Inconsistent splitting behavior fix
1 parent 035f3d6 commit e6ea2e0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/installer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class DotnetCoreInstaller {
215215
if (downloadUrls.length == 0) {
216216
throw `Could not construct download URL. Please ensure that specified version ${version} is valid.`;
217217
}
218+
core.debug(`Got download urls ${downloadUrls}`);
218219
return downloadUrls;
219220
});
220221
}
@@ -276,6 +277,10 @@ class DotnetCoreInstaller {
276277
let legacyUrl = '';
277278
if (!!output && output.length > 0) {
278279
let lines = output.split(os.EOL);
280+
// Fallback to \n if initial split doesn't work (not consistent across versions)
281+
if (lines.length === 1) {
282+
lines = output.split('\n');
283+
}
279284
if (!!lines && lines.length > 0) {
280285
lines.forEach((line) => {
281286
if (!line) {

src/installer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ export class DotnetCoreInstaller {
232232
throw `Could not construct download URL. Please ensure that specified version ${version} is valid.`;
233233
}
234234

235+
core.debug(`Got download urls ${downloadUrls}`);
236+
235237
return downloadUrls;
236238
}
237239

@@ -307,6 +309,11 @@ export class DotnetCoreInstaller {
307309
let legacyUrl: string = '';
308310
if (!!output && output.length > 0) {
309311
let lines: string[] = output.split(os.EOL);
312+
313+
// Fallback to \n if initial split doesn't work (not consistent across versions)
314+
if (lines.length === 1) {
315+
lines = output.split('\n');
316+
}
310317
if (!!lines && lines.length > 0) {
311318
lines.forEach((line: string) => {
312319
if (!line) {

0 commit comments

Comments
 (0)