diff options
author | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-09-17 16:42:53 +0200 |
---|---|---|
committer | Enrico Tassi <Enrico.Tassi@inria.fr> | 2014-09-17 16:45:43 +0200 |
commit | d3fb99846bdb9f7e0724dde70c8704dfda843bbb (patch) | |
tree | b85dad7047c96ccc7430492c23ac85bdfec00297 /tools | |
parent | 0c974eb2e4788d1af2d1b759bd4ada3cb1fb9e77 (diff) |
Revert "coqc: execvp is now available even on win32"
This reverts commit 60c390951cb2d771c16758a84bf592d06769da14.
The reason is that execvp exists on windows but is "non blocking".
So coqc would detach "coqtop -compile" and make would fail trying
to step to the next target before "coqtop -compile" terminates (because
coqc did terminate already).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/coqc.ml | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/coqc.ml b/tools/coqc.ml index 5aa6f0b04..80733e668 100644 --- a/tools/coqc.ml +++ b/tools/coqc.ml @@ -18,6 +18,10 @@ line to a process running "coqtop -batch -compile <file>". *) +(* Environment *) + +let environment = Unix.environment () + let binary = ref "coqtop" let image = ref "" @@ -38,7 +42,19 @@ let rec make_compilation_args = function let compile command args files = let args' = command :: args @ (make_compilation_args files) in - Unix.execvp command (Array.of_list args') + match Sys.os_type with + | "Win32" -> + let pid = + Unix.create_process_env command (Array.of_list args') environment + Unix.stdin Unix.stdout Unix.stderr + in + let status = snd (Unix.waitpid [] pid) in + let errcode = + match status with Unix.WEXITED c|Unix.WSTOPPED c|Unix.WSIGNALED c -> c + in + exit errcode + | _ -> + Unix.execvpe command (Array.of_list args') environment let usage () = Usage.print_usage_coqc () ; |