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
There is no way to add a shutdown hook #12170
Comments
Added Area-Library, Library-Isolate, Triaged labels. |
Removed Type-Defect label. |
This comment was originally written by @kaendfinger This can be marked as fixed I think, because we can add hooks for SIGTERM. |
This comment was originally written by @zoechi Does this work on all platforms? |
This comment was originally written by googlegroups...@kaioa.com According to the docs, most of those process signals are not available on Windows: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-io.ProcessSignal#id_watch I just tried it myself. This example works with Linux, but not with Windows: import 'dart:io'; On Windows, it bombs with: Uncaught Error: SignalException: Failed to listen for SIGTERM |
Note: calling exit(0) does not call SIGTERM listeners. I think that this decision should be re-evaluated. |
This comment was originally written by @kaendfinger Whatever node does to fake SIGTERM or something for it's exit listener, that's what we need to do. |
This could be solved by an exit-callback for the current isolate: #21999 |
We now have addOnExitListener |
This issue was originally filed by googlegroups...@kaioa.com
Java got
addShutdownHook
, Ruby gotat_exit
, Python got anatexit
module, and Node gotprocess.on('SIGTERM', ...)
.Dart doesn't seem to offer anything comparable.
Relevant SO thread:
http://stackoverflow.com/questions/11001071/shutdown-hook-in-dart
The text was updated successfully, but these errors were encountered: