Expose argv to preload process object

This commit is contained in:
Kevin Sawicki 2017-06-26 13:52:19 -07:00
parent cf392e402c
commit 14178d9826
3 changed files with 7 additions and 1 deletions

View file

@ -80,6 +80,10 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate, v8::Local<v8::String> key,
return exports;
}
base::CommandLine::StringVector GetArgv() {
return base::CommandLine::ForCurrentProcess()->argv();
}
void InitializeBindings(v8::Local<v8::Object> binding,
v8::Local<v8::Context> context) {
auto isolate = context->GetIsolate();
@ -87,6 +91,7 @@ void InitializeBindings(v8::Local<v8::Object> binding,
b.SetMethod("get", GetBinding);
b.SetMethod("crash", AtomBindings::Crash);
b.SetMethod("hang", AtomBindings::Hang);
b.SetMethod("getArgv", GetArgv);
b.SetMethod("getProcessMemoryInfo", &AtomBindings::GetProcessMemoryInfo);
b.SetMethod("getSystemMemoryInfo", &AtomBindings::GetSystemMemoryInfo);
}