diff --git a/dist/index.js b/dist/index.js index 016158c..59deee9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -301,10 +301,6 @@ class DotnetCoreInstaller { } installDotnet() { return __awaiter(this, void 0, void 0, function* () { - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR']; - if (dotnetInstallDir) { - core.debug(`DOTNET_INSTALL_DIR is set up to ${dotnetInstallDir}`); - } const windowsDefaultOptions = [ '-NoLogo', '-Sta', @@ -337,10 +333,10 @@ class DotnetCoreInstaller { if (process.env['no_proxy'] != null) { scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); } - if (!dotnetInstallDir) { - scriptArguments.push('-InstallDir', `'${DotnetCoreInstaller.installationDirectoryWindows}'`); + if (!process.env['DOTNET_INSTALL_DIR']) { + process.env['DOTNET_INSTALL_DIR'] = + DotnetCoreInstaller.installationDirectoryWindows; } - // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used scriptPath = (yield io.which('pwsh', false)) || (yield io.which('powershell', true)); scriptArguments = windowsDefaultOptions.concat(scriptArguments); @@ -355,12 +351,13 @@ class DotnetCoreInstaller { if (this.quality) { this.setQuality(dotnetVersion, scriptArguments); } - if (!dotnetInstallDir) { - scriptArguments.push('--install-dir', utils_1.IS_LINUX + if (!process.env['DOTNET_INSTALL_DIR']) { + process.env['DOTNET_INSTALL_DIR'] = utils_1.IS_LINUX ? DotnetCoreInstaller.installationDirectoryLinux - : DotnetCoreInstaller.installationDirectoryMac); + : DotnetCoreInstaller.installationDirectoryMac; } } + // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used const getExecOutputOptions = { ignoreReturnCode: true, env: process.env @@ -369,9 +366,7 @@ class DotnetCoreInstaller { if (exitCode) { throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`); } - return this.outputDotnetVersion(dotnetVersion.value, dotnetInstallDir - ? dotnetInstallDir - : scriptArguments[scriptArguments.length - 1]); + return this.outputDotnetVersion(dotnetVersion.value, process.env['DOTNET_INSTALL_DIR']); }); } outputDotnetVersion(version, installationPath) { diff --git a/src/installer.ts b/src/installer.ts index 6a7702e..f7730a6 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -170,10 +170,6 @@ export class DotnetCoreInstaller { } public async installDotnet(): Promise { - const dotnetInstallDir = process.env['DOTNET_INSTALL_DIR']; - if (dotnetInstallDir) { - core.debug(`DOTNET_INSTALL_DIR is set up to ${dotnetInstallDir}`); - } const windowsDefaultOptions = [ '-NoLogo', '-Sta', @@ -212,13 +208,11 @@ export class DotnetCoreInstaller { scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`); } - if (!dotnetInstallDir) { - scriptArguments.push( - '-InstallDir', - `'${DotnetCoreInstaller.installationDirectoryWindows}'` - ); + if (!process.env['DOTNET_INSTALL_DIR']) { + process.env['DOTNET_INSTALL_DIR'] = + DotnetCoreInstaller.installationDirectoryWindows; } - // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used + scriptPath = (await io.which('pwsh', false)) || (await io.which('powershell', true)); scriptArguments = windowsDefaultOptions.concat(scriptArguments); @@ -235,16 +229,13 @@ export class DotnetCoreInstaller { this.setQuality(dotnetVersion, scriptArguments); } - if (!dotnetInstallDir) { - scriptArguments.push( - '--install-dir', - IS_LINUX - ? DotnetCoreInstaller.installationDirectoryLinux - : DotnetCoreInstaller.installationDirectoryMac - ); + if (!process.env['DOTNET_INSTALL_DIR']) { + process.env['DOTNET_INSTALL_DIR'] = IS_LINUX + ? DotnetCoreInstaller.installationDirectoryLinux + : DotnetCoreInstaller.installationDirectoryMac; } } - + // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used const getExecOutputOptions = { ignoreReturnCode: true, env: process.env as {string: string} @@ -260,9 +251,7 @@ export class DotnetCoreInstaller { return this.outputDotnetVersion( dotnetVersion.value, - dotnetInstallDir - ? dotnetInstallDir - : scriptArguments[scriptArguments.length - 1] + process.env['DOTNET_INSTALL_DIR'] ); }