Skip to content

Commit

Permalink
handle SIGHUP and SIGQUIT
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Mar 1, 2017
1 parent 82002d8 commit 49ac2e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion daemonize.nim
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ template daemonize*(pidfile, si, so, se, cd: string,body: stmt): stmt {.immediat

c_signal(SIGINT, onStop)
c_signal(SIGTERM, onStop)
c_signal(SIGHUP, onStop)
c_signal(SIGQUIT, onStop)

pid = getpid()
writeFile(pidfile, $pid)
Expand All @@ -76,5 +78,5 @@ when isMainModule:
i.inc()
echo i
discard sleep(1)
daemonize("/tmp/daemonize.pid", "/dev/null", "/tmp/daemonize.out", "/tmp/daemonize.err"):
daemonize("/tmp/daemonize.pid", "/dev/null", "/tmp/daemonize.out", "/tmp/daemonize.err", "/"):
main()
2 changes: 1 addition & 1 deletion daemonize.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Package]
name = "daemonize"
version = "0.0.3"
version = "0.0.4"
author = "Huy Doan"
description = "This library makes your code run as a daemon process on Unix-like systems"
license = "MIT"
Expand Down

0 comments on commit 49ac2e2

Please sign in to comment.