save history when receving a sighup
Ignore-this: 219e88bce2dafc999b6f2f73a16274bf darcs-hash:20120215154929-c41ad-6377472357c9ff2e29abfc794ec23e988872f9d9
This commit is contained in:
parent
6aeb61432a
commit
d2e0e79dd4
|
@ -18,6 +18,8 @@ open UTop_private
|
|||
|
||||
module String_set = Set.Make(String)
|
||||
|
||||
exception Term of int
|
||||
|
||||
(* +-----------------------------------------------------------------+
|
||||
| History |
|
||||
+-----------------------------------------------------------------+ *)
|
||||
|
@ -688,7 +690,20 @@ let common_init () =
|
|||
ignore (Toploop.use_silently Format.err_formatter fn));
|
||||
(* Load history after the initialization file so the user can change
|
||||
the history file name. *)
|
||||
Lwt_main.run (init_history ())
|
||||
Lwt_main.run (init_history ());
|
||||
(* Install signal handlers. *)
|
||||
let behavior = Sys.Signal_handle (fun signo -> raise (Term signo)) in
|
||||
let catch signo =
|
||||
try
|
||||
Sys.set_signal signo behavior
|
||||
with _ ->
|
||||
(* All signals may not be supported on some OS. *)
|
||||
()
|
||||
in
|
||||
(* We lost the terminal. *)
|
||||
catch Sys.sighup;
|
||||
(* Termination request. *)
|
||||
catch Sys.sigterm
|
||||
|
||||
let load_inputrc () =
|
||||
try_lwt
|
||||
|
|
|
@ -9,3 +9,9 @@
|
|||
|
||||
val main : unit -> unit
|
||||
(** Start utop. *)
|
||||
|
||||
exception Term of int
|
||||
(** Exception raised when a signal that should terminate the process
|
||||
is received. The argument is the signal number.
|
||||
|
||||
utop raises this exception for SIGHUP and SIGTERM by default. *)
|
||||
|
|
Loading…
Reference in New Issue