Use Filename.quote_command (#9476)
parent
c5a1f91900
commit
15b08d2fdf
|
@ -166,13 +166,12 @@ let check_file ?(tool = default_comparison_tool) files =
|
|||
|
||||
let diff files =
|
||||
let temporary_file = Filename.temp_file "ocamltest" "diff" in
|
||||
let diff_commandline = String.concat " "
|
||||
[
|
||||
"diff -u";
|
||||
let diff_commandline =
|
||||
Filename.quote_command "diff" ~stdout:temporary_file
|
||||
[ "-u";
|
||||
files.reference_filename;
|
||||
files.output_filename;
|
||||
"> " ^ temporary_file
|
||||
] in
|
||||
files.output_filename ]
|
||||
in
|
||||
let result =
|
||||
if (Sys.command diff_commandline) = 2 then Stdlib.Error "diff"
|
||||
else Ok (Sys.string_of_file temporary_file)
|
||||
|
|
|
@ -155,7 +155,10 @@ let test_file test_filename =
|
|||
let test_build_directory_prefix =
|
||||
get_test_build_directory_prefix test_directory in
|
||||
let clean_test_build_directory () =
|
||||
ignore (Sys.command ("rm -rf " ^ test_build_directory_prefix)) in
|
||||
ignore
|
||||
(Sys.command
|
||||
(Filename.quote_command "rm" ["-rf"; test_build_directory_prefix]))
|
||||
in
|
||||
clean_test_build_directory ();
|
||||
Sys.make_directory test_build_directory_prefix;
|
||||
let summary = Sys.with_chdir test_build_directory_prefix
|
||||
|
|
|
@ -102,8 +102,7 @@ module Sys = struct
|
|||
|
||||
let mkdir dir =
|
||||
if not (Sys.file_exists dir) then
|
||||
let quoted_dir = "\"" ^ dir ^ "\"" in
|
||||
run_system_command ("mkdir " ^ quoted_dir)
|
||||
run_system_command (Filename.quote_command "mkdir" [dir])
|
||||
|
||||
let rec make_directory dir =
|
||||
if Sys.file_exists dir then ()
|
||||
|
|
|
@ -250,10 +250,10 @@ let find_dyn_offset filename =
|
|||
Fun.protect
|
||||
~finally:(fun () -> remove_file tempfile)
|
||||
(fun () ->
|
||||
let rc = Sys.command (sprintf "%s %s > %s"
|
||||
(Filename.quote helper)
|
||||
(Filename.quote filename)
|
||||
tempfile) in
|
||||
let rc =
|
||||
Sys.command
|
||||
(Filename.quote_command helper ~stdout:tempfile [filename])
|
||||
in
|
||||
if rc <> 0 then failwith "cannot read";
|
||||
let tc = Scanf.Scanning.from_file tempfile in
|
||||
Fun.protect
|
||||
|
|
Loading…
Reference in New Issue