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

Fix "error: Forever detected script exited with code: null" #702

Merged
merged 1 commit into from
Jun 27, 2015
Merged

Fix "error: Forever detected script exited with code: null" #702

merged 1 commit into from
Jun 27, 2015

Conversation

hughescr
Copy link
Contributor

When a process dies from a signal and has no exit code, forever logs this incorrectly. It is checking isNaN(code), which is wrong. isNaN(x) does not check that x is numeric; it merely checks if x is equal to NaN; since code is either null or an integer, this can never be true in this context. isNaN(null) === false.

This patch corrects this bad check, to verify that code was in fact passed by the exit handler. If it wasn't, then we fall through to print the signal that killed the monitored process.

…s equal to NaN. In particular it won't catch null.
@ericdolson
Copy link

I would love to see this fix added. I am having an issue where I am trying to SIGKILL my app programmatically which results in a code===null. But since the isNan(null) resolves to true, my app restarts when it should not.

@emaV
Copy link

emaV commented May 27, 2015

This solve my issue with upstart. When trying to stop the service the app return null and forever keeps restarting when it should simply stop.

@michaelmcmillan
Copy link

Should this not be merged?

@indexzero
Copy link
Member

This looks good at first glance, but we should have test coverage for this before merging it in.

indexzero added a commit that referenced this pull request Jun 27, 2015
Fix "error: Forever detected script exited with code: null"
@indexzero indexzero merged commit 37229d0 into foreversd:master Jun 27, 2015
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

Successfully merging this pull request may close these issues.

5 participants