diff options
| author | Michael Soegtrop | 2020-03-10 21:19:37 +0100 |
|---|---|---|
| committer | Michael Soegtrop | 2020-03-10 21:19:37 +0100 |
| commit | 4cc3f613c96197dd9e6b5f531fa4c68968f27176 (patch) | |
| tree | afa3990aa5fc44c5367e47c813a8022365ef8cd2 | |
| parent | 3a5469b2097c55ecf952ead470caf03b6112cd9e (diff) | |
| parent | f560d8b91b92cb537e415d622d4f5f248c18dde0 (diff) | |
Merge PR #11788: Prevent CoqIDE from hanging when invalid channels are still open.
Reviewed-by: MSoegtropIMC
| -rw-r--r-- | ide/coqide.ml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ide/coqide.ml b/ide/coqide.ml index 61e95c21b1..553b834a37 100644 --- a/ide/coqide.ml +++ b/ide/coqide.ml @@ -244,6 +244,13 @@ let close_and_quit () = List.iter (fun sn -> Coq.close_coqtop sn.coqtop) notebook#pages; exit 0 +(* Work around a deadlock due to OCaml exit cleanup. The standard [exit] + function calls [flush_all], which can block if one of the opened channels is + not valid anymore. We do not register [at_exit] functions in CoqIDE, so + instead of flushing we simply die as gracefully as possible in the function + below. *) +external sys_exit : int -> 'a = "caml_sys_exit" + let crash_save exitcode = Minilib.log "Starting emergency save of buffers in .crashcoqide files"; let idx = @@ -263,7 +270,7 @@ let crash_save exitcode = in List.iter save_session notebook#pages; Minilib.log "End emergency save"; - exit exitcode + sys_exit exitcode end |
