Skip to content

Commit

Permalink
Added custom command
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth-hk committed Mar 31, 2020
1 parent 01b0d1a commit 542eb45
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions commands/sxcustom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// modules
const path = require("path");
const { spawn } = require("child_process");

// imports
var sxconfig = require(path.join(__dirname, "..", "sxconfig.json"));

function sxcustom(index, key) {
let cmd = `${sxconfig.Custom[index][key]}`;
let command = spawn(cmd, [], { shell: true });

command.stdout.on("data", data => {
console.log(`${data}`);
});

command.stderr.on("data", data => {
console.log(`Error occured while executing ${sxconfig.Custom[index][key]}`);
});
}

module.exports = sxcustom;

0 comments on commit 542eb45

Please sign in to comment.