coreybutler / coreybutler/node-windows

wrapper.js: reset attempts and log exit code

Open
#256 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

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));`

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.