win: Add ELECTRON_DEFAULT_ERROR_MODE env

It is useful to help debugging crashes without opening debugger.
This commit is contained in:
Cheng Zhao 2015-11-06 18:51:34 +08:00
parent 863199348f
commit acf4372cf7

View file

@ -14,6 +14,7 @@
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/base_paths.h" #include "base/base_paths.h"
#include "base/environment.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/path_service.h" #include "base/path_service.h"
@ -141,6 +142,14 @@ void NodeBindings::Initialize() {
// Init node. // Init node.
// (we assume node::Init would not modify the parameters under embedded mode). // (we assume node::Init would not modify the parameters under embedded mode).
node::Init(nullptr, nullptr, nullptr, nullptr); node::Init(nullptr, nullptr, nullptr, nullptr);
#if defined(OS_WIN)
// uv_init overrides error mode to suppress the default crash dialog, bring
// it back if user wants to show it.
scoped_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar("ELECTRON_DEFAULT_ERROR_MODE"))
SetErrorMode(0);
#endif
} }
node::Environment* NodeBindings::CreateEnvironment( node::Environment* NodeBindings::CreateEnvironment(