File: abort.ml

package info (click to toggle)
unison2.13.16 2.13.16-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,900 kB
  • ctags: 2,820
  • sloc: ml: 20,312; objc: 1,087; makefile: 485; ansic: 180; sh: 62
file content (29 lines) | stat: -rw-r--r-- 640 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

let debug = Trace.debug "abort"

let files = ref ([] : Uutil.File.t list)
let abortAll = ref false

(****)

let reset () = files := []; abortAll := false

(****)

let file id =
  debug (fun() -> Util.msg "Aborting line %d\n" (Uutil.File.toLine id));
  files := id :: !files

let all () = abortAll := true

(****)

let check id =
  debug (fun() -> Util.msg "Checking line %d\n" (Uutil.File.toLine id));
  if !abortAll || Safelist.mem id !files then begin
    debug (fun() ->
      Util.msg "Abort failure for line %d\n" (Uutil.File.toLine id));
    raise (Util.Transient "Aborted")
  end

let testException e = e = Util.Transient "Aborted"