Skip to content

Commit

Permalink
remove logging for exec, logging only on error
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Oct 18, 2020
1 parent be0f379 commit 3067028
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const {spawn} = require('child_process');

const exec = (cmd, args = [], options = {}) => new Promise((resolve, reject) => {
console.log(`Started: ${cmd} ${args.join(' ')}`);
const optionsToCLI = {
...options
};
Expand All @@ -11,6 +10,7 @@ const exec = (cmd, args = [], options = {}) => new Promise((resolve, reject) =>
const app = spawn(cmd, args, optionsToCLI);
app.on('close', (code) => {
if (code !== 0) {
console.log(`Error on: ${cmd} ${args.join(' ')}`);
const err = new Error(`Invalid status code: ${code}`);
err.code = code;
return reject(err);
Expand Down

0 comments on commit 3067028

Please sign in to comment.