diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-12 12:47:36 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-12 12:47:36 +0000 |
commit | c8bd730465e966622d2602048fc0696ec22e406e (patch) | |
tree | fd257b5f2975216e24560ff4ff63d092d728967e | |
parent | fc4d722c884d0d808874eca4dd4d707f987c3ef8 (diff) |
Quoter les arguments pour create_process (PR#2512)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6392 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/win32unix/unix.ml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/otherlibs/win32unix/unix.ml b/otherlibs/win32unix/unix.ml index e76d432d2..0f100ed7e 100644 --- a/otherlibs/win32unix/unix.ml +++ b/otherlibs/win32unix/unix.ml @@ -739,12 +739,18 @@ external win_create_process : string -> string -> string option -> file_descr -> file_descr -> file_descr -> int = "win_create_process" "win_create_process_native" +let make_cmdline args = + let maybe_quote f = + if String.contains f ' ' || String.contains f '\"' + then Filename.quote f + else f in + String.concat " " (List.map maybe_quote (Array.to_list args)) + let create_process prog args fd1 fd2 fd3 = - win_create_process prog (String.concat " " (Array.to_list args)) None - fd1 fd2 fd3 + win_create_process prog (make_cmdline args) None fd1 fd2 fd3 let create_process_env prog args env fd1 fd2 fd3 = - win_create_process prog (String.concat " " (Array.to_list args)) + win_create_process prog (make_cmdline args) (Some(String.concat "\000" (Array.to_list env) ^ "\000")) fd1 fd2 fd3 |