Use Filename.quote_command

master
Nicolás Ojeda Bär 2020-05-24 13:00:47 +02:00 committed by Gabriel Scherer
parent 6c311f3007
commit 3eebf1ab8c
3 changed files with 6 additions and 5 deletions

View File

@ -63,8 +63,7 @@ let files env = words_of_variable env Builtin_variables.files
let setup_symlinks test_source_directory build_directory files =
let symlink filename =
let src = Filename.concat test_source_directory filename in
let cmd = "ln -sf " ^ src ^" " ^ build_directory in
Sys.run_system_command cmd in
Sys.run_system_command "ln" ["-sf"; src; build_directory] in
let copy filename =
let src = Filename.concat test_source_directory filename in
let dst = Filename.concat build_directory filename in

View File

@ -93,7 +93,9 @@ module Sys = struct
close_in ic;
filesize = 0
let run_system_command command = match Sys.command command with
let run_system_command prog args =
let command = Filename.quote_command prog args in
match Sys.command command with
| 0 -> ()
| _ as exitcode ->
Printf.eprintf "Sysem command %s failed with status %d\n%!"
@ -102,7 +104,7 @@ module Sys = struct
let mkdir dir =
if not (Sys.file_exists dir) then
run_system_command (Filename.quote_command "mkdir" [dir])
run_system_command "mkdir" [dir]
let rec make_directory dir =
if Sys.file_exists dir then ()

View File

@ -46,7 +46,7 @@ end
module Sys : sig
include module type of Sys
val file_is_empty : string -> bool
val run_system_command : string -> unit
val run_system_command : string -> string list -> unit
val make_directory : string -> unit
val string_of_file : string -> string
val copy_chan : in_channel -> out_channel -> unit