mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
Throw error only if exit code is note zero. (#358)
This commit is contained in:
parent
04c56d2f95
commit
9a74eb4e64
4 changed files with 20 additions and 7 deletions
|
@ -30,9 +30,16 @@ export const supportedPackageManagers: SupportedPackageManagers = {
|
|||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue