diff --git a/doc/changes/10869.md b/doc/changes/10869.md new file mode 100644 index 000000000000..3467dd2ee337 --- /dev/null +++ b/doc/changes/10869.md @@ -0,0 +1,2 @@ +- Fix staged pps preprocessors on Windows (which were not working at all + previously) (#10869, @nojb) diff --git a/otherlibs/stdune/src/string.ml b/otherlibs/stdune/src/string.ml index 81438928f873..1420d5e26425 100644 --- a/otherlibs/stdune/src/string.ml +++ b/otherlibs/stdune/src/string.ml @@ -278,7 +278,22 @@ let need_quoting s = ;; let quote_for_shell s = if need_quoting s then Stdlib.Filename.quote s else s -let quote_list_for_shell l = List.map l ~f:quote_for_shell |> concat ~sep:" " + +let quote_list_for_shell = function + | [] -> "" + | prog :: args -> + let prog = + if Sys.win32 && contains prog '/' + then + map + ~f:(function + | '/' -> '\\' + | c -> c) + prog + else prog + in + quote_for_shell prog :: List.map ~f:quote_for_shell args |> concat ~sep:" " +;; let of_list chars = let s = Bytes.make (List.length chars) '0' in diff --git a/otherlibs/stdune/src/string.mli b/otherlibs/stdune/src/string.mli index 5caa864fadcf..8619861d2a69 100644 --- a/otherlibs/stdune/src/string.mli +++ b/otherlibs/stdune/src/string.mli @@ -116,8 +116,8 @@ val need_quoting : string -> bool [true] *) val quote_for_shell : string -> string -(** [quote_list_for_shell l] is - [List.map l ~f:quote_for_shell |> concat ~sep:" "] *) +(** [quote_list_for_shell l] quotes a command-line so that it can be passed to + the system shell (eg by using [Sys.command]). *) val quote_list_for_shell : string list -> string val filter_map : string -> f:(char -> char option) -> string diff --git a/test/blackbox-tests/test-cases/dune b/test/blackbox-tests/test-cases/dune index 630343865a75..59e394349d58 100644 --- a/test/blackbox-tests/test-cases/dune +++ b/test/blackbox-tests/test-cases/dune @@ -29,7 +29,7 @@ (alias runtest-js))) (cram - (applies_to windows-diff) + (applies_to windows-diff github6644) (alias runtest-windows)) ; DISABLED TESTS