Friday, February 27, 2009

hdaemonize on hackage

Having got a green light from Andre, I uploaded hdaemonize to Hackage.

I also cleaned up the library a bit. Reading up on POSIX signals I decided that it is wrong for the daemonize library to mess with them beyond blocking HUP. Also, now it has two functions, daemonize :: IO () -> IO () which does the bare minimum, and serviced :: Program -> IO () that does that and more, for example writing a PID file, handling start/stop/restart, catching and logging exceptions to syslog.

Time to try it out in production.

5 comments:

  1. Looks like theres a bug, During compile I get:

    System/Posix/Daemonize.hs:111:19:
    Not in scope: type constructor or class `SomeException'
    cabal: Error: some packages failed to install:
    hdaemonize-0.1 failed during the building phase. The exception was:
    exit: ExitFailure 1


    via cabal install.

    ReplyDelete
  2. I managed to fix it by explicitly importing SomeException from the import Control.Exception line. I don't know how to use the git machine, so I can't send you the patch, but all I did was:

    - import Control.Exception
    + import Control.Exception (SomeException, IOException, finally, try, catch)

    ReplyDelete
  3. Thanks Joe. I think I unknowingly used a feature introduced in GHC10 and incompatible with GHC8. Will incorporate your patch today.

    ReplyDelete
  4. Hi Joe. I am not sure I completely understand the situation, but hopefully it was a problem with Exception libraries. I ported the package to GHC 6.8 and just uploaded a new version that hopefully solves whe issue with exceptions libraries. Basically I just used the extensible-exceptions package that backports GHC 6.10 exception handling back to GHC 6.8; hope this helps. If you have further problems, please let me know your platform, GHC and Cabal versions. Thanks!

    ReplyDelete
  5. hmm
    cabal install hdaemonize isn't working (failing on download) going to try manual install.

    ...

    after the manual download, I did a cabal install in the directory, seems to be working now. I was compiling w/ 6.10 before.

    Thanks for the fix! loving the package so far, I was dreading writing all that unixy lowlevel code.

    ReplyDelete