coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.79k stars 358 forks source link

abortOnError checks for instanceof Boolean, so primitive `true` is interpreted as `false` #229

Closed theredpea closed 4 years ago

theredpea commented 5 years ago

Not sure if intentional, may be "working as designed" daemon.js abortOnError argument checks for instanceof Boolean,

This means if I pass abortOnError : true (primitive true), the daemon will interpret and run with the argument false!

If it helps I can make pull request to do either of these:

  1. Change the daemon.js line to stop using instanceof
    • to this: config.abortOnError === true ? config.abortOnError : false
    • checking for == true is more consistent with the other line (this.abortOnError==true?'y':'n'),
  2. Change the documentation to recommend a Boolean object instead of a Boolean primitive
    • so remove this:

      an attribute called abortOnError can be set to true...

    • replace with this:

      an attribute called abortOnError can be set to new Boolean(true)...

coreybutler commented 4 years ago

Yeah, that was a kludgy implementation. It's updated in master.