Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit c2e19a9

Browse files
committed
Ignore exit code for choco and ghcup installs
This means that they can now fallback to alternatve install options
1 parent d811023 commit c2e19a9

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

dist/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11111,7 +11111,9 @@ async function choco(tool, version) {
1111111111
'-m',
1111211112
'--no-progress',
1111311113
'-r'
11114-
]);
11114+
], {
11115+
ignoreReturnCode: true
11116+
});
1111511117
}
1111611118
async function ghcupBin(os) {
1111711119
const v = '0.1.8';
@@ -11125,8 +11127,10 @@ async function ghcupBin(os) {
1112511127
async function ghcup(tool, version, os) {
1112611128
core.info(`Attempting to install ${tool} ${version} using ghcup`);
1112711129
const bin = await ghcupBin(os);
11128-
await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]);
11129-
if (tool === 'ghc')
11130+
const returnCode = await exec_1.exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version], {
11131+
ignoreReturnCode: true
11132+
});
11133+
if (returnCode === 0 && tool === 'ghc')
1113011134
await exec_1.exec(bin, ['set', version]);
1113111135
}
1113211136

src/installer.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,22 @@ async function apt(tool: Tool, version: string): Promise<void> {
170170
async function choco(tool: Tool, version: string): Promise<void> {
171171
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
172172

173-
await exec('powershell', [
174-
'choco',
175-
'install',
176-
tool,
177-
'--version',
178-
version,
179-
'-m',
180-
'--no-progress',
181-
'-r'
182-
]);
173+
await exec(
174+
'powershell',
175+
[
176+
'choco',
177+
'install',
178+
tool,
179+
'--version',
180+
version,
181+
'-m',
182+
'--no-progress',
183+
'-r'
184+
],
185+
{
186+
ignoreReturnCode: true
187+
}
188+
);
183189
}
184190

185191
async function ghcupBin(os: OS): Promise<string> {
@@ -199,6 +205,12 @@ async function ghcupBin(os: OS): Promise<string> {
199205
async function ghcup(tool: Tool, version: string, os: OS): Promise<void> {
200206
core.info(`Attempting to install ${tool} ${version} using ghcup`);
201207
const bin = await ghcupBin(os);
202-
await exec(bin, [tool === 'ghc' ? 'install' : 'install-cabal', version]);
203-
if (tool === 'ghc') await exec(bin, ['set', version]);
208+
const returnCode = await exec(
209+
bin,
210+
[tool === 'ghc' ? 'install' : 'install-cabal', version],
211+
{
212+
ignoreReturnCode: true
213+
}
214+
);
215+
if (returnCode === 0 && tool === 'ghc') await exec(bin, ['set', version]);
204216
}

0 commit comments

Comments
 (0)