Added lib string-argv to extract bin and args from cmd

This commit is contained in:
2021-11-25 18:32:43 +01:00
parent 1a9ced0bb8
commit dcd0ce8111
3 changed files with 19 additions and 2 deletions

View File

@@ -1,9 +1,11 @@
const logger = require("./logger.js")("exec");
const { spawn } = require("child_process");
const { parseArgsStringToArgv } = require('string-argv');
function exec(cmd, options){
const [bin, ...args] = parseArgsStringToArgv(cmd);
logger.addContext("binary", "bin");
logger.debug(`Spawn process '${cmd}'`);