Skip to content

Commit 9a74eb4

Browse files
Throw error only if exit code is note zero. (actions#358)
1 parent 04c56d2 commit 9a74eb4

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

.github/workflows/licensed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install licensed
1919
run: |
2020
cd $RUNNER_TEMP
21-
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
21+
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
2222
sudo tar -xzf licensed.tar.gz
2323
sudo mv licensed /usr/local/bin/licensed
2424
- run: licensed status

dist/cache-save/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,8 +3836,11 @@ exports.supportedPackageManagers = {
38363836
}
38373837
};
38383838
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
3839-
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand);
3840-
if (stderr) {
3839+
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
3840+
if (exitCode) {
3841+
stderr = !stderr.trim()
3842+
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
3843+
: stderr;
38413844
throw new Error(stderr);
38423845
}
38433846
return stdout.trim();

dist/setup/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46207,8 +46207,11 @@ exports.supportedPackageManagers = {
4620746207
}
4620846208
};
4620946209
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
46210-
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand);
46211-
if (stderr) {
46210+
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
46211+
if (exitCode) {
46212+
stderr = !stderr.trim()
46213+
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
46214+
: stderr;
4621246215
throw new Error(stderr);
4621346216
}
4621446217
return stdout.trim();

src/cache-utils.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ export const supportedPackageManagers: SupportedPackageManagers = {
3030
};
3131

3232
export const getCommandOutput = async (toolCommand: string) => {
33-
const {stdout, stderr, exitCode} = await exec.getExecOutput(toolCommand);
33+
let {stdout, stderr, exitCode} = await exec.getExecOutput(
34+
toolCommand,
35+
undefined,
36+
{ignoreReturnCode: true}
37+
);
3438

35-
if (stderr) {
39+
if (exitCode) {
40+
stderr = !stderr.trim()
41+
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
42+
: stderr;
3643
throw new Error(stderr);
3744
}
3845

0 commit comments

Comments
 (0)