You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
462 B
JavaScript
23 lines
462 B
JavaScript
const logger = require("./logger.js")("exec");
|
|
|
|
const { spawn } = require("child_process");
|
|
|
|
|
|
function exec(cmd, stdout, stderr, exit_handler){
|
|
const [bin, ...args] = cmd.split(' ')
|
|
|
|
logger.addContext("binary", "bin");
|
|
logger.debug(`Spawn process '${cmd}'`);
|
|
let proc = spawn(bin, args);
|
|
|
|
return {
|
|
"process": proc,
|
|
"stdout": proc.stdout,
|
|
"stderr": proc.stderr
|
|
}
|
|
}
|
|
|
|
// Specify exports
|
|
module.exports = {
|
|
exec
|
|
}; |