diff --git a/CHANGES.md b/CHANGES.md index b9fd2dd5b..c4c379879 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ - Report `#require` directive errors (#276, @gpetiot) - Handle no such file exception: the input file and the values of options `--root` and `--prelude` are checked (#292, @gpetiot) - Keep locations from parsing instead of recomputing the lines, providing better error messages (#241, @gpetiot) +- Use `create_process` instead of `execvp` to call `mdx-test` from `mdx`. This fixes part of the test suite on Windows (#299, @emillon) #### Security diff --git a/bin/test.ml b/bin/test.ml index cab24b068..d1f5be645 100644 --- a/bin/test.ml +++ b/bin/test.ml @@ -41,7 +41,12 @@ let run (`Setup ()) _ _ _ _ _ _ _ _ _ _ = let argv = Array.sub Sys.argv 1 (Array.length Sys.argv - 1) in argv.(0) <- cmd; Log.debug (fun l -> l "executing %a" Fmt.(Dump.array string) argv); - Unix.execvp cmd argv + let pid = Unix.create_process cmd argv Unix.stdin Unix.stdout Unix.stderr in + let _pid, status = Unix.waitpid [] pid in + let exit_code = + match status with WEXITED n -> n | WSIGNALED _ -> 1 | WSTOPPED _ -> 1 + in + exit exit_code open Cmdliner