Add app.exit() API to exit with specified exit status.
This commit is contained in:
parent
9c86978da0
commit
5f26b83ec1
2 changed files with 11 additions and 0 deletions
|
@ -50,6 +50,15 @@ v8::Handle<v8::Value> App::Quit(const v8::Arguments &args) {
|
|||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::Exit(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
exit(args[0]->IntegerValue());
|
||||
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> App::Terminate(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
|
@ -100,6 +109,7 @@ void App::Initialize(v8::Handle<v8::Object> target) {
|
|||
t->SetClassName(v8::String::NewSymbol("Application"));
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "quit", Quit);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "exit", Exit);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "terminate", Terminate);
|
||||
|
||||
target->Set(v8::String::NewSymbol("Application"), t->GetFunction());
|
||||
|
|
|
@ -31,6 +31,7 @@ class App : public EventEmitter,
|
|||
static v8::Handle<v8::Value> New(const v8::Arguments &args);
|
||||
|
||||
static v8::Handle<v8::Value> Quit(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Exit(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Terminate(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> AppendSwitch(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> AppendArgument(const v8::Arguments &args);
|
||||
|
|
Loading…
Reference in a new issue