coreybutler / coreybutler/node-windows

service uninstall dies when other apps share the daemon folder

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.9k
Forks
368
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.