diff --git a/package-lock.json b/package-lock.json index 37faa91..e80026a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "@influxdata/influxdb-client": "^1.20.0", "log4js": "^6.3.0", - "luxon": "^2.1.1" + "luxon": "^2.1.1", + "string-argv": "^0.3.1" } }, "node_modules/@influxdata/influxdb-client": { @@ -128,6 +129,14 @@ "node": ">=4.0" } }, + "node_modules/string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -228,6 +237,11 @@ } } }, + "string-argv": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", + "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==" + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/package.json b/package.json index b7b1bd4..233ef01 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dependencies": { "@influxdata/influxdb-client": "^1.20.0", "log4js": "^6.3.0", - "luxon": "^2.1.1" + "luxon": "^2.1.1", + "string-argv": "^0.3.1" } } diff --git a/src/helper/exec.js b/src/helper/exec.js index 5523f5c..ed7f628 100644 --- a/src/helper/exec.js +++ b/src/helper/exec.js @@ -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}'`);