Signer: remove socket on all more termination signals

This commit is contained in:
Vincent Bernardoff 2018-11-01 23:07:17 +01:00 committed by Benjamin Canou
parent d1c46b5cf2
commit 56fa339937

View File

@ -65,11 +65,13 @@ let run (cctxt : #Client_context.wallet) path ?magic_bytes ~check_high_watermark
-% s host_name host -% s host_name host
-% s service_name service) -% s service_name service)
| Unix path -> | Unix path ->
Sys.set_signal Sys.sigint (Signal_handle begin fun _ -> List.iter begin fun signal ->
Format.printf "Removing the local socket file and quitting.@." ; Sys.set_signal signal (Signal_handle begin fun _ ->
Unix.unlink path ; Format.printf "Removing the local socket file and quitting.@." ;
exit 0 Unix.unlink path ;
end) ; exit 0
end)
end Sys.[sigint ; sigterm] ;
log Tag.DSL.(fun f -> log Tag.DSL.(fun f ->
f "Accepting UNIX requests on %s" f "Accepting UNIX requests on %s"
-% t event "accepting_unix_requests" -% t event "accepting_unix_requests"