Merge pull request #1998 from deepak1556/process_patch
process: add hang method
This commit is contained in:
commit
befdfceada
2 changed files with 10 additions and 0 deletions
|
@ -26,6 +26,11 @@ void Crash() {
|
||||||
static_cast<DummyClass*>(NULL)->crash = true;
|
static_cast<DummyClass*>(NULL)->crash = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hang() {
|
||||||
|
for (;;)
|
||||||
|
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
|
||||||
|
}
|
||||||
|
|
||||||
// Called when there is a fatal error in V8, we just crash the process here so
|
// Called when there is a fatal error in V8, we just crash the process here so
|
||||||
// we can get the stack trace.
|
// we can get the stack trace.
|
||||||
void FatalErrorCallback(const char* location, const char* message) {
|
void FatalErrorCallback(const char* location, const char* message) {
|
||||||
|
@ -54,6 +59,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
|
||||||
|
|
||||||
mate::Dictionary dict(isolate, process);
|
mate::Dictionary dict(isolate, process);
|
||||||
dict.SetMethod("crash", &Crash);
|
dict.SetMethod("crash", &Crash);
|
||||||
|
dict.SetMethod("hang", &Hang);
|
||||||
dict.SetMethod("log", &Log);
|
dict.SetMethod("log", &Log);
|
||||||
dict.SetMethod("activateUvLoop",
|
dict.SetMethod("activateUvLoop",
|
||||||
base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this)));
|
base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this)));
|
||||||
|
|
|
@ -7,3 +7,7 @@ upstream node:
|
||||||
* `process.versions['electron']` String - Version of Electron.
|
* `process.versions['electron']` String - Version of Electron.
|
||||||
* `process.versions['chrome']` String - Version of Chromium.
|
* `process.versions['chrome']` String - Version of Chromium.
|
||||||
* `process.resourcesPath` String - Path to JavaScript source code.
|
* `process.resourcesPath` String - Path to JavaScript source code.
|
||||||
|
|
||||||
|
## process.hang
|
||||||
|
|
||||||
|
Causes the main thread of the current process hang.
|
||||||
|
|
Loading…
Reference in a new issue