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
Proxy process.on("exit") to avoid MaxListenersExceededWarning #42
Conversation
c52fa68
to
9a131a8
Compare
@mike-marcacci Won't you now just get the MaxListenersExceededWarning on the |
9a131a8
to
767d413
Compare
@gabegorelick 🤦🏼 indeed haha; that is now fixed in the PR. |
767d413
to
5ac9923
Compare
@mike-marcacci may I suggest doing regular commits when working on the PR, vs force-pushes? That way the email notifications, PR history, etc. has the changes as incremental diffs which is easier to follow. You can always squash the PR to a single commit when merging it if you prefer a single commit on |
Co-authored-by: Jayden Seric <me@jaydenseric.com>
Co-authored-by: Jayden Seric <me@jaydenseric.com>
Co-authored-by: Jayden Seric <me@jaydenseric.com>
Co-authored-by: Jayden Seric <me@jaydenseric.com>
Co-authored-by: Jayden Seric <me@jaydenseric.com>
Co-authored-by: Jayden Seric <me@jaydenseric.com>
@jaydenseric yes indeed, that would probably be helpful here. I'm in the habit of staging larger PRs with distinct, logical commits (as opposed to "historical" commits), which can then be reviewed more easily. But for smaller PRs, yes I definitely agree: keeping the history greatly helps collaboration 👍🏼 |
Originally, when supporting node 8, we could not use `on` `off` and `once` methods on streams (because they did not exist). Accordingly, I chose to use `addListener` and `removeListener` both on streams and events, for consistency. With support for that version long-gone, we can now use the prefered methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t have the bandwidth right now to go too deep into reviewing this, but the approach looks good to me.
It would be absurd, but I wonder what would happen if you constructed a new |
That's a good question with a pretty straightforward answer actually: nothing 🙃 Node will not schedule another event frame when this event is fired, and so only synchronous code gets executed in these handlers. |
This fixes #30, working around node's MaxListenersExceededWarning by creating a "proxy" event emitter to forward
exit
events.This is a more concise alternative to #34.