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
|
[ "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>
|
<process>
|
||||||
"notepad" >>command
|
"notepad" >>command
|
||||||
|
|
|
@ -58,7 +58,11 @@ TUPLE: CreateProcess-args
|
||||||
0 count-trailing-backslashes
|
0 count-trailing-backslashes
|
||||||
2 * CHAR: \\ <repetition> append ;
|
2 * CHAR: \\ <repetition> append ;
|
||||||
|
|
||||||
|
: escape-double-quote ( str -- newstr )
|
||||||
|
"\"" split "\\\"" join ;
|
||||||
|
|
||||||
: escape-argument ( str -- newstr )
|
: escape-argument ( str -- newstr )
|
||||||
|
escape-double-quote
|
||||||
CHAR: \s over member? [
|
CHAR: \s over member? [
|
||||||
fix-trailing-backslashes "\"" dup surround
|
fix-trailing-backslashes "\"" dup surround
|
||||||
] when ;
|
] when ;
|
||||||
|
|
Loading…
Reference in New Issue