kohsuke / akuma

Embeddable daemonization library
http://akuma.kohsuke.org/
132 stars 32 forks source link

(enhancement) Expose dup2() from libc, Daemon optionally redirect str… #12

Open davebrown opened 7 years ago

davebrown commented 7 years ago

…eams

Allow user to redirect stdout, stderr after fork() instead of closing them. Expose dup() and dup2() in CLibrary to accomplish the above. Add dup2() unit test.

I have a Dropwizard service that I would like to daemonize. Some of the dependencies I'm using write to stdout and stderr, and they get errors when they're closed and the service fails to boot.

The change here uses dup2() to redirect them to files in the log directory instead.

davebrown commented 7 years ago

@kohsuke will you take a look at this PR?