Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: move Exit into node_process
  • Loading branch information
jasnell committed May 22, 2018
commit 5abe91f8d892d4d5ebfa48c998d0e69156be1366
8 changes: 3 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1105,14 +1105,12 @@ static void WaitForInspectorDisconnect(Environment* env) {
#endif
}


static void Exit(const FunctionCallbackInfo<Value>& args) {
WaitForInspectorDisconnect(Environment::GetCurrent(args));
NO_RETURN void Exit(Environment* env, int32_t code) {
WaitForInspectorDisconnect(env);
v8_platform.StopTracingAgent();
exit(args[0]->Int32Value());
exit(code);
}


extern "C" void node_module_register(void* m) {
struct node_module* mp = reinterpret_cast<struct node_module*>(m);

Expand Down
8 changes: 8 additions & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,14 @@ extern "C" NODE_EXTERN void node_module_register(void* mod);
*/
#define NODE_MODULE_DECL /* nothing */

#ifdef __GNUC__
#define NO_RETURN __attribute__((noreturn))
#else
#define NO_RETURN
#endif

NO_RETURN void Exit(Environment* env, int32_t code);

/* Called after the event loop exits but before the VM is disposed.
* Callbacks are run in reverse order of registration, i.e. newest first.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/node_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ using v8::Uint32;
using v8::Uint32Array;
using v8::Value;

void Exit(const FunctionCallbackInfo<Value>& args) {
Exit(Environment::GetCurrent(args), args[0]->Int32Value());
}

void Chdir(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

Expand Down
1 change: 1 addition & 0 deletions src/node_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void Chdir(const FunctionCallbackInfo<Value>& args);
void CPUUsage(const FunctionCallbackInfo<Value>& args);
void Cwd(const FunctionCallbackInfo<Value>& args);
void DLOpen(const FunctionCallbackInfo<Value>& args);
void Exit(const FunctionCallbackInfo<Value>& args);
void GetActiveRequests(const FunctionCallbackInfo<Value>& args);
void GetActiveHandles(const FunctionCallbackInfo<Value>& args);
void Hrtime(const FunctionCallbackInfo<Value>& args);
Expand Down