1
0
Fork 0
mirror of https://github.com/actions/setup-node synced 2024-12-22 21:22:42 +00:00

Throw error only if exit code is note zero. (#358)

This commit is contained in:
Dmitry Shibanov 2021-12-27 12:34:06 +03:00 committed by GitHub
parent 04c56d2f95
commit 9a74eb4e64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View file

@ -18,7 +18,7 @@ jobs:
- name: Install licensed - name: Install licensed
run: | run: |
cd $RUNNER_TEMP cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed sudo mv licensed /usr/local/bin/licensed
- run: licensed status - run: licensed status

View file

@ -3836,8 +3836,11 @@ exports.supportedPackageManagers = {
} }
}; };
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand); let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
if (stderr) { if (exitCode) {
stderr = !stderr.trim()
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
: stderr;
throw new Error(stderr); throw new Error(stderr);
} }
return stdout.trim(); return stdout.trim();

7
dist/setup/index.js vendored
View file

@ -46207,8 +46207,11 @@ exports.supportedPackageManagers = {
} }
}; };
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () { exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
const { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand); let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
if (stderr) { if (exitCode) {
stderr = !stderr.trim()
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
: stderr;
throw new Error(stderr); throw new Error(stderr);
} }
return stdout.trim(); return stdout.trim();

View file

@ -30,9 +30,16 @@ export const supportedPackageManagers: SupportedPackageManagers = {
}; };
export const getCommandOutput = async (toolCommand: string) => { export const getCommandOutput = async (toolCommand: string) => {
const {stdout, stderr, exitCode} = await exec.getExecOutput(toolCommand); let {stdout, stderr, exitCode} = await exec.getExecOutput(
toolCommand,
undefined,
{ignoreReturnCode: true}
);
if (stderr) { if (exitCode) {
stderr = !stderr.trim()
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
: stderr;
throw new Error(stderr); throw new Error(stderr);
} }