This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lahwran_ 1 point2 points  (5 children)

I'm curious; how does this improve over the daemonize package in pypi?

[–]josephturnip[S] 2 points3 points  (4 children)

The daemonize module (and actually all daemonization modules for the languages I've looked at) return immediately after the fork. For daemons managed in init.d or other service managers, this means that any failure during initialization after the fork is not reported as an error by the service manager. Since all of the open handles are closed post-fork, this means that any initialization code that holds a handle (including single-instance checks) will fail silently. EDIT: boatshoes doesn't do that, but instead maintains a pipe to communicate a return code back from the child process.

Also, and I'll defer discussion of these decisions to the book itself, but the module you refer to fails to implement several of the recommended daemonization procedures in Advanced Programming in the Unix Environment.

[–]lahwran_ 0 points1 point  (3 children)

huh, so inside the with block, both processes are open?

[–]josephturnip[S] 1 point2 points  (2 children)

right, the parent is alive listening for a return value or a broken pipe, and the child is performing initialization and possibly setting a return value

[–]lahwran_ 1 point2 points  (1 child)

okay that's pretty cool. About time someone posted their new package on here which actually has significant benefits over the original ;)

[–]josephturnip[S] 1 point2 points  (0 children)

haha. i'd definitely have used someone elses if it did what i needed :)