Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daemon fork doesn't inherit Node CLI flags such as --enable_gc #40

Open
jhuckaby opened this issue Mar 13, 2016 · 0 comments
Open

Daemon fork doesn't inherit Node CLI flags such as --enable_gc #40

jhuckaby opened this issue Mar 13, 2016 · 0 comments

Comments

@jhuckaby
Copy link

I discovered that if my node script was launched with any Node CLI flags such as --enable_gc (which exposes the internal Node Garbage Collector), this flag does not pass down to the daemon fork. Example:

node --enable_gc mydaemon.js

I see that internal node flags are not included on the process.argv array, so there is apparently no way the daemon module can preserve them.

I worked around this by detecting the presence of global.gc and then splicing the --enable_gc flag back into the process.argv array just before calling daemon:

if (!process.env.__daemon && global.gc) {
    process.argv.splice( 1, 0, '--expose_gc' );
}
require('daemon')();

- Joe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant