Skip to content

Commit 83f6a20

Browse files
EugeneSuslaholgerbrandl
authored andcommitted
Fixed space-containing argument propagation #98 (#104)
1 parent 2489a24 commit 83f6a20

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

kscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jarPath=$(dirname $abs_kscript_path)/kscript.jar
2525
if [[ $(uname) == CYGWIN* ]]; then jarPath=$(cygpath -w ${jarPath}); fi
2626

2727
## run it using command substitution to have just the user process once kscript is done
28-
exec $(kotlin -classpath ${jarPath} kscript.app.KscriptKt "$@")
28+
eval "exec $(kotlin -classpath ${jarPath} kscript.app.KscriptKt "$@")"

src/main/kotlin/kscript/app/Kscript.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ fun main(args: Array<String>) {
237237
}
238238

239239

240-
// print the final command to be run by exec
241-
val joinedUserArgs = userArgs.joinToString(" ")
240+
// print the final command to be run by eval+exec
241+
val joinedUserArgs = userArgs.map { "\"${it.replace("\"", "\\\"")}\"" }.joinToString(" ")
242242

243243
//if requested try to package the into a standalone binary
244244
if (docopt.getBoolean("package")) {

0 commit comments

Comments
 (0)