Skip to content

Commit

Permalink
fix: ignore return code of npm audit fix (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored May 18, 2021
1 parent b9a4260 commit 38f4153
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 14 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9100,8 +9100,20 @@ exports.withCustomRequest = withCustomRequest;
const { exec } = __webpack_require__(986);
const npmArgs = __webpack_require__(510);

module.exports = function auditFix() {
return exec("npm", npmArgs("audit", "fix"));
module.exports = async function auditFix() {
let error = "";
await exec("npm", npmArgs("audit", "fix"), {
listeners: {
stderr: (data) => {
error += data.toString();
},
},
ignoreReturnCode: true,
});

if (error.includes("npm ERR!")) {
throw new Error("Unexpected error occurred");
}
};


Expand Down
16 changes: 14 additions & 2 deletions lib/auditFix.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
const { exec } = require("@actions/exec");
const npmArgs = require("./npmArgs");

module.exports = function auditFix() {
return exec("npm", npmArgs("audit", "fix"));
module.exports = async function auditFix() {
let error = "";
await exec("npm", npmArgs("audit", "fix"), {
listeners: {
stderr: (data) => {
error += data.toString();
},
},
ignoreReturnCode: true,
});

if (error.includes("npm ERR!")) {
throw new Error("Unexpected error occurred");
}
};

0 comments on commit 38f4153

Please sign in to comment.