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

service uninstall dies when other apps share the daemon folder #117

Open
cpjones999 opened this issue Mar 13, 2016 · 1 comment
Open

service uninstall dies when other apps share the daemon folder #117

cpjones999 opened this issue Mar 13, 2016 · 1 comment

Comments

@cpjones999
Copy link

I needed to uninstall a service I had previously installed and had several other services in the same folder so they and their associated log files were in the same daemon folder as well. I needed to reinstall the service to increase default memory size using:

var nodeArg= '--max-old-space-size=4096 --harmony';

var svc = new Service({
name: botname + ' Service',
description:botname + ' Service',
script: script,
env: [{
name: 'NODE_ENV',
value: process.env['NODE_ENV']
}],
flags: nodeArg // <--- here
});

I attempted to uninstall a specific service and found that the uninstall died due to locked log files from another service that was running which I figured out was due to this piece of code in daemon.js:

// Remove all other files
var _files = fs.readdirSync(me.root);
_files.forEach(function(f){
rm(f);
});

So I switched it to use glob as:

var glob= require('glob');
var _files = glob.sync(path.join(me.root,me.id + '*.out.log'));
_files.forEach(function(f){
rm(f);
});

This fixed the problem.

@coreybutler
Copy link
Owner

Feel free to submit this as a PR. If you decided to, these changes would also be relevant to node-mac and node-linux.

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

2 participants