Przeglądaj źródła

allowed Ctrl+C to break macros loops

Nicolas Cannasse 14 lat temu
rodzic
commit
879c949026
2 zmienionych plików z 2 dodań i 1 usunięć
  1. 1 1
      interp.ml
  2. 1 0
      main.ml

+ 1 - 1
interp.ml

@@ -1681,7 +1681,7 @@ let rec eval ctx (e,p) =
 			| _ ->
 				VNull
 		in
-		loop()
+		(try loop() with Sys.Break -> throw ctx p "Ctrl+C")
 	| EWhile (econd,e,DoWhile) ->
 		let rec loop() =
 			let v = (try

+ 1 - 0
main.ml

@@ -684,6 +684,7 @@ with
 
 ;;
 let all = Common.timer "other" in
+Sys.catch_break true;
 process_params [] (List.tl (Array.to_list Sys.argv));
 all();
 if !measure_times then begin