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

Listen for 'exit' event instead of 'close' event. #1

Open
tristanls opened this issue Jul 7, 2014 · 0 comments
Open

Listen for 'exit' event instead of 'close' event. #1

tristanls opened this issue Jul 7, 2014 · 0 comments

Comments

@tristanls
Copy link
Owner

When monitoring the ElasticSearch server, listen for exit event instead of close event.

See documentation as to the difference between the two: http://nodejs.org/api/child_process.html#child_process_event_exit

Event: 'exit'

  • code Number the exit code, if it exited normally.
  • signal String the signal passed to kill the child process, if it was killed by the parent.

This event is emitted after the child process ends. If the process terminated normally, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null.

Note that the child process stdio streams might still be open.

Also, note that node establishes signal handlers for 'SIGINT' and 'SIGTERM', so it will not terminate due to receipt of those signals, it will exit.

See waitpid(2).

Event: 'close'

  • code Number the exit code, if it exited normally.
  • signal String the signal passed to kill the child process, if it was killed by the parent.

This event is emitted when the stdio streams of a child process have all terminated. This is distinct from 'exit', since multiple processes might share the same stdio streams.

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