Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Created January 28, 2016 22:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noisesmith/e6a3e0ae424e129ece19 to your computer and use it in GitHub Desktop.
Save noisesmith/e6a3e0ae424e129ece19 to your computer and use it in GitHub Desktop.
handling signals in clojure
kingfisher.core=> (def hndlr (reify sun.misc.SignalHandler (handle [this signal](println "handling some sig!"))))
#'kingfisher.core/hndlr
kingfisher.core=> (sun.misc.Signal/handle (sun.misc.Signal. "USR2") hndlr)
#object[kingfisher.core$reify__32853 0x6bc27f36 "kingfisher.core$reify__32853@6bc27f36"]
kingfisher.core=> (clojure.java.shell/sh "kill" "-s" "SIGUSR2" "72011")
handling some sig!
{:exit 0, :out "", :err ""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment