Hi all !
In Dtools, when we call Init.init, is does:
let init ?(prohibit_root=false) f =
if prohibit_root then exit_when_root ();
let signal_h i = () in
Sys.set_signal Sys.sigterm (Sys.Signal_handle signal_h);
Sys.set_signal Sys.sigint (Sys.Signal_handle signal_h);
then daemonize (main f)
else catch (main f) (fun () -> ())
In FreeBSD the attached script (a shutdown 5 seconds after startup) fails to
stop correctly. However, it closes correctly when commenting out the signal
Init.init is used main.ml with Tutils.main to create the main loop.
Interestingly, the main loop ends, but the process does not quit.
Apparently, discarding all signal handlers on those signals in FreeBSD
prevents the process from closing correctly.
Is there a reason for this piece of code ? How could we fix this (if not
obviously by removing them/making them optional) ?