Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper.js: reset attempts and log exit code #256

Open
clausreinke opened this issue May 19, 2020 · 0 comments
Open

wrapper.js: reset attempts and log exit code #256

clausreinke opened this issue May 19, 2020 · 0 comments

Comments

@clausreinke
Copy link

currently, the following lines are dead code as child is null when monitor is called

node-windows/lib/wrapper.js

Lines 120 to 125 in accfbd0

} else {
// reset attempts and wait time
attempts = 0;
wait = argv.w * 1000;
}
};

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 (

child = fork(script,args,opts);
) 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.

node-windows/lib/wrapper.js

Lines 165 to 166 in accfbd0

child.on('exit',function(code){
log.warn(argv.f+' stopped running.');

log.warn(argv.f+' stopped running with code: '+code.toString(16));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant