Skip to content

Commit 3b29fbb

Browse files
committed
shQuote options script path
1 parent 3b72047 commit 3b29fbb

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

libs/odmRunner.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,13 @@ module.exports = {
127127
const env = utils.clone(process.env);
128128
env.ODM_OPTIONS_TMP_FILE = utils.tmpPath(".json");
129129
env.ODM_PATH = config.odm_path;
130-
const shEscape = s => {
131-
if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
132-
s = "'"+s.replace(/'/g,"'\\''")+"'";
133-
s = s.replace(/^(?:'')+/g, '')
134-
.replace(/\\'''/g, "\\'" );
135-
}
136-
return s;
130+
const shQuote = s => {
131+
s = s.replace(/"/g, "")
132+
return `"${s}"`;
137133
}
138134

139-
let childProcess = spawn(pythonExe, [path.join(__dirname, "..", "helpers", "odmOptionsToJson.py"),
140-
"--project-path", shEscape(`"${config.odm_path}"`), "bogusname"], { env, stdio: 'inherit', shell: true });
135+
let childProcess = spawn(pythonExe, [shQuote(path.join(__dirname, "..", "helpers", "odmOptionsToJson.py")),
136+
"--project-path", shQuote(config.odm_path), "bogusname"], { env, stdio: 'inherit', shell: true });
141137

142138
// Cleanup on done
143139
let handleResult = (err, result) => {

0 commit comments

Comments
 (0)