On Windows, escape command line arguments with double quotes with a backslash: " -> \". Fixes #245.
parent
84fda0bb05
commit
871dfb9a3a
|
@ -13,6 +13,12 @@ IN: io.launcher.windows.tests
|
|||
|
||||
[ "bob \"mac arthur\\\\\"" ] [ { "bob" "mac arthur\\" } join-arguments ] unit-test
|
||||
|
||||
! Bug #245
|
||||
[ "\\\"hi\\\"" ] [ { "\"hi\"" } join-arguments ] unit-test
|
||||
|
||||
[ "\"\\\"hi you\\\"\"" ] [ { "\"hi you\"" } join-arguments ] unit-test
|
||||
|
||||
|
||||
[ ] [
|
||||
<process>
|
||||
"notepad" >>command
|
||||
|
|
|
@ -58,7 +58,11 @@ TUPLE: CreateProcess-args
|
|||
0 count-trailing-backslashes
|
||||
2 * CHAR: \\ <repetition> append ;
|
||||
|
||||
: escape-double-quote ( str -- newstr )
|
||||
"\"" split "\\\"" join ;
|
||||
|
||||
: escape-argument ( str -- newstr )
|
||||
escape-double-quote
|
||||
CHAR: \s over member? [
|
||||
fix-trailing-backslashes "\"" dup surround
|
||||
] when ;
|
||||
|
|
Loading…
Reference in New Issue