diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-10-04 00:29:41 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-10-11 03:20:53 +0300 |
commit | 278d38f4cf3d2821984660b4de73f8d414db17c7 (patch) | |
tree | 60aef3854353c414d8371b6ac613debcba49585f /src/node.h | |
parent | 275153ddc4fe0e49d5f73807edaa6eca0c3041cb (diff) |
src: add maybe versions of EmitExit and EmitBeforeExit
This addresses a TODO comment, and removes invalid `.ToLocalChecked()`
calls from our code base.
PR-URL: https://github.com/nodejs/node/pull/35486
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/node.h b/src/node.h index 8b018bac69b..f09c979a4be 100644 --- a/src/node.h +++ b/src/node.h @@ -534,8 +534,19 @@ NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform); NODE_EXTERN v8::TracingController* GetTracingController(); NODE_EXTERN void SetTracingController(v8::TracingController* controller); -NODE_EXTERN void EmitBeforeExit(Environment* env); -NODE_EXTERN int EmitExit(Environment* env); +// Run `process.emit('beforeExit')` as it would usually happen when Node.js is +// run in standalone mode. +NODE_EXTERN v8::Maybe<bool> EmitProcessBeforeExit(Environment* env); +NODE_DEPRECATED("Use Maybe version (EmitProcessBeforeExit) instead", + NODE_EXTERN void EmitBeforeExit(Environment* env)); +// Run `process.emit('exit')` as it would usually happen when Node.js is run +// in standalone mode. The return value corresponds to the exit code. +NODE_EXTERN v8::Maybe<int> EmitProcessExit(Environment* env); +NODE_DEPRECATED("Use Maybe version (EmitProcessExit) instead", + NODE_EXTERN int EmitExit(Environment* env)); + +// Runs hooks added through `AtExit()`. This is part of `FreeEnvironment()`, +// so calling it manually is typically not necessary. NODE_EXTERN void RunAtExit(Environment* env); // This may return nullptr if the current v8::Context is not associated |