[MLton-commit] r7170
Matthew Fluet
fluet at mlton.org
Wed Jun 17 21:00:58 PDT 2009
Restore cygwinEscape for MLton.Process.create.
This passes the args-create.sml regression, although this passes
arguments to itself (a cygwin program). I don't know how these
escaped arguments would be interpreted by a pure windows crt program.
----------------------------------------------------------------------
U mlton/trunk/basis-library/mlton/process.sml
----------------------------------------------------------------------
Modified: mlton/trunk/basis-library/mlton/process.sml
===================================================================
--- mlton/trunk/basis-library/mlton/process.sml 2009-06-17 23:02:38 UTC (rev 7169)
+++ mlton/trunk/basis-library/mlton/process.sml 2009-06-18 04:00:57 UTC (rev 7170)
@@ -316,12 +316,21 @@
if not (strContains " \t\"" y) andalso y<>"" then y else
String.implode (List.rev (#"\"" :: mingwQuote y))
- fun cygwinEscape y = y
+ fun cygwinEscape y =
+ if not (strContains " \t\"\r\n\f'" y) andalso y<>"" then y else
+ concat ["\"",
+ String.translate
+ (fn #"\"" => "\\\"" | #"\\" => "\\\\" | x => String.str x) y,
+ "\""]
- val cmdEscape =
+ val cmdEscapeCreate =
if MLton.Platform.OS.host = MLton.Platform.OS.MinGW
then mingwEscape else cygwinEscape
+ val cmdEscapeSpawn =
+ if MLton.Platform.OS.host = MLton.Platform.OS.MinGW
+ then mingwEscape else (fn s => s)
+
fun launchWithCreate (path, args, env, stdin, stdout, stderr) =
let
val path' =
@@ -336,7 +345,7 @@
end)
val args' =
NullString.nullTerm
- (String.concatWith " " (List.map cmdEscape (path :: args)))
+ (String.concatWith " " (List.map cmdEscapeCreate (path :: args)))
val env' =
Option.map
(fn env =>
@@ -400,7 +409,7 @@
if useWindowsProcess
then
let
- val args = List.map cmdEscape args
+ val args = List.map cmdEscapeSpawn args
val path = NullString.nullTerm path
val args = CUtil.C_StringArray.fromList args
val env = CUtil.C_StringArray.fromList env
@@ -425,7 +434,7 @@
then
let
val file = NullString.nullTerm file
- val args = List.map cmdEscape args
+ val args = List.map cmdEscapeSpawn args
val args = CUtil.C_StringArray.fromList args
in
(PId.fromRep o SysCall.simpleResult')
More information about the MLton-commit
mailing list