coreybutler / coreybutler/node-windows

XML always Generated for stopparentfirst with value undefined

Open
#209 0 comments 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 noticed that even if I don't specify the `stopparentfirst` parameter when initializing the `Service` object, I always get the `stopparentfirst` argument and a value of `undefined`, instead of the default of `false-y`.

For example, the following code:

```
const svc = new Service(
{
name: 'SomeName"
description: 'SomeDescription',
script:'somefile.js',
}
);
svc.install();
```

Will always have the following in the generated `somefile.xml`

```
--stopparentfirst
undefined
```
Looking at [code](https://github.com/coreybutler/node-windows/blob/d52ee3215665fe5f94a9ad91a15afa2b05293b90/lib/daemon.js#L98-L109) we should probably use the approach we use for `--abortonerror`:

```
_xml: {
enumerable: false,
get: function(){
var wrapperArgs = [
'--file', this.script,
'--log', this.name + ' ' + 'wrapper',
'--grow', this.grow,
'--wait', this.wait,
'--maxrestarts', this.maxRestarts,
'--abortonerror', (this.abortOnError==true?'y':'n'),
'--stopparentfirst', (this.stopparentfirst==true?'y':'n') // changed line
];
```

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.