Don't ever call stop_user_input in line_loop

The caller is now always responsible for calling stop_user_input, rather
than only responsible for calling it on error.
master
David Allsopp 2019-10-19 11:47:07 +01:00
parent 37acb3bf24
commit d0bab08f15
2 changed files with 5 additions and 3 deletions

View File

@ -210,7 +210,7 @@ let line_loop ppf line_buffer =
done done
with with
| Exit -> | Exit ->
stop_user_input () ()
(* | Sys_error s -> (* | Sys_error s ->
error ("System error: " ^ s) *) error ("System error: " ^ s) *)
@ -571,6 +571,7 @@ let instr_source ppf lexbuf =
interactif := false; interactif := false;
user_channel := io_chan; user_channel := io_chan;
line_loop ppf (Lexing.from_function read_user_input); line_loop ppf (Lexing.from_function read_user_input);
stop_user_input ();
close_io io_chan; close_io io_chan;
interactif := old_state; interactif := old_state;
user_channel := old_channel user_channel := old_channel

View File

@ -29,7 +29,7 @@ open Primitives
let line_buffer = Lexing.from_function read_user_input let line_buffer = Lexing.from_function read_user_input
let loop ppf = line_loop ppf line_buffer let loop ppf = line_loop ppf line_buffer; stop_user_input ()
let current_duration = ref (-1L) let current_duration = ref (-1L)
@ -130,7 +130,8 @@ let execute_file_if_any () =
let len = Buffer.length buffer in let len = Buffer.length buffer in
if len > 0 then if len > 0 then
let commands = Buffer.sub buffer 0 (pred len) in let commands = Buffer.sub buffer 0 (pred len) in
line_loop Format.std_formatter (Lexing.from_string commands) line_loop Format.std_formatter (Lexing.from_string commands);
stop_user_input ()
let toplevel_loop () = let toplevel_loop () =
interactif := false; interactif := false;