node-windows
node-windows copied to clipboard
wrapper.js: reset attempts and log exit code
currently, the following lines are dead code as child
is null
when monitor
is called
https://github.com/coreybutler/node-windows/blob/accfbd0528ad5148cb6283e5d8f2b407f890dfbc/lib/wrapper.js#L120-L125
This suggests that monitor
may not be used as originally intended, and it means that even successful restarts suffer from accumulated delays, keeping the child offline without reason.
Given the ressource limitations on this project, I would suggest a minor fix: after the fork
(https://github.com/coreybutler/node-windows/blob/accfbd0528ad5148cb6283e5d8f2b407f890dfbc/lib/wrapper.js#L162) add
if (child && child.pid) {
// reset attempts and wait time
attempts = 0;
wait = argv.w * 1000;
}
Also, please don't hide the child's exit code - it is sometimes the only available clue to what went wrong.
https://github.com/coreybutler/node-windows/blob/accfbd0528ad5148cb6283e5d8f2b407f890dfbc/lib/wrapper.js#L165-L166
log.warn(argv.f+' stopped running with code: '+code.toString(16));