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

Allow async code #1

Closed
sindresorhus opened this issue Aug 31, 2014 · 5 comments · Fixed by #20
Closed

Allow async code #1

sindresorhus opened this issue Aug 31, 2014 · 5 comments · Fixed by #20

Comments

@sindresorhus
Copy link
Owner

sindresorhus commented Aug 31, 2014

Currently, only sync code can be executed.

Could use the beforeExit event.

@kevva
Copy link

kevva commented Apr 12, 2016

Don't know if beforeExit is that useful since it's not emitted on process.exit() or other events that causes explicit termination.

@sindresorhus
Copy link
Owner Author

Relevant Node.js discussion: nodejs/node#29480

@devsnek
Copy link

devsnek commented Oct 2, 2019

This is slightly different from that issue actually. We purposely disallow async tasks to be queued while node is exiting, and it isn't a goal of ours to allow that, since you could just delay the process exiting indefinitely...

@Townsheriff
Copy link

This is slightly different from that issue actually. We purposely disallow async tasks to be queued while node is exiting, and it isn't a goal of ours to allow that, since you could just delay the process exiting indefinitely...

It wont stop users from stopping process anyway, if they want to dismiss some signals they can do it.

It is very useful for cleaning spawned and detached resources.

@sindresorhus
Copy link
Owner Author

We purposely disallow async tasks to be queued while node is exiting, and it isn't a goal of ours to allow that, since you could just delay the process exiting indefinitely...

I could delay it indefinitely synchronously already. I don't see why that should stop a highly desired feature. If delaying it indefinitely is a problem, add a reasonable timeout that can be configured.

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