travelping / sighandler

Handle UNIX signals in Erlang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#sighandler

License: Apache 2

1> application:start(sighandler).
ok
2> {ok, Ref} = sighandler:install(hup, fun() -> io:format("HUP!~n") end).
{ok,#Ref<0.0.0.66>}
3> os:cmd(io_lib:format("kill -HUP ~s", [os:getpid()])).
HUP!
[]
4> ok = sighandler:remove(Ref).
ok
3> os:cmd(io_lib:format("kill -HUP ~s", [os:getpid()])).
Hangup: 1

Should work with Erlang R13B04 or later on UNIX like platforms. Has been known to work with R13B04 and R15B on Darwin and with R14B04 on Linux.

About

Handle UNIX signals in Erlang

License:Apache License 2.0