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

This commit is contained in:
Dmitry Shibanov authored and GitHub committed 2021-12-27 12:34:06 +03:00
1 parent 04c56d2f95
commit 9a74eb4e64
4 files changed
+20 -7

No files matched your search

+9 -2
View File
@@ -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);
}