Skip to content

Commit f1d4f2a

Browse files
authored
Escape the arguments to be executed via eval (#410)
Refer to https://stackoverflow.com/a/50367671 As eval builtin interprets its arguments in the same way as shell would do, which would need some escape work, otherwise, it won't work if the input arguments contains e.g. a JSON string: omnitrace-python -- ./test.py --json='{"foo": "bar"}' Signed-off-by: Hollow Man <[email protected]>
1 parent 3761ed0 commit f1d4f2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/Templates/console-script.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ run-script()
1414
eval $@
1515
}
1616

17-
run-script ${PYTHON_EXECUTABLE} -m @SCRIPT_SUBMODULE@ $@
17+
run-script ${PYTHON_EXECUTABLE} -m @SCRIPT_SUBMODULE@ "$(printf ' %q' "$@")"

0 commit comments

Comments
 (0)