Ignore exit code for choco and ghcup installs

This means that they can now fallback to alternatve install options
This commit is contained in:
Luke Lau
2020-07-27 13:27:27 +01:00
parent d8110230de
commit c2e19a92bb
2 changed files with 31 additions and 15 deletions

10
dist/index.js vendored
View File

@@ -11111,7 +11111,9 @@ async function choco(tool, version) {
'-m', '-m',
'--no-progress', '--no-progress',
'-r' '-r'
]); ], {
ignoreReturnCode: true
});
} }
async function ghcupBin(os) { async function ghcupBin(os) {
const v = '0.1.8'; const v = '0.1.8';
@@ -11125,8 +11127,10 @@ async function ghcupBin(os) {
async function ghcup(tool, version, os) { async function ghcup(tool, version, os) {
core.info(`Attempting to install ${tool} ${version} using ghcup`); core.info(`Attempting to install ${tool} ${version} using ghcup`);
const bin = await ghcupBin(os); const bin = await ghcupBin(os);
await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]); const returnCode = await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version], {
if (tool === 'ghc') ignoreReturnCode: true
});
if (returnCode === 0 && tool === 'ghc')
await exec_1.exec(bin, ['set', version]); await exec_1.exec(bin, ['set', version]);
} }

View File

@@ -170,16 +170,22 @@ async function apt(tool: Tool, version: string): Promise<void> {
async function choco(tool: Tool, version: string): Promise<void> { async function choco(tool: Tool, version: string): Promise<void> {
core.info(`Attempting to install ${tool} ${version} using chocolatey`); core.info(`Attempting to install ${tool} ${version} using chocolatey`);
await exec('powershell', [ await exec(
'choco', 'powershell',
'install', [
tool, 'choco',
'--version', 'install',
version, tool,
'-m', '--version',
'--no-progress', version,
'-r' '-m',
]); '--no-progress',
'-r'
],
{
ignoreReturnCode: true
}
);
} }
async function ghcupBin(os: OS): Promise<string> { async function ghcupBin(os: OS): Promise<string> {
@@ -199,6 +205,12 @@ async function ghcupBin(os: OS): Promise<string> {
async function ghcup(tool: Tool, version: string, os: OS): Promise<void> { async function ghcup(tool: Tool, version: string, os: OS): Promise<void> {
core.info(`Attempting to install ${tool} ${version} using ghcup`); core.info(`Attempting to install ${tool} ${version} using ghcup`);
const bin = await ghcupBin(os); const bin = await ghcupBin(os);
await exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]); const returnCode = await exec(
if (tool === 'ghc') await exec(bin, ['set', version]); bin,
[tool === 'ghc' ? 'install' : 'install-cabal', version],
{
ignoreReturnCode: true
}
);
if (returnCode === 0 && tool === 'ghc') await exec(bin, ['set', version]);
} }