From acf4372cf7d8a07a9c55763ac2bb726e962aa251 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 6 Nov 2015 18:51:34 +0800 Subject: [PATCH] win: Add ELECTRON_DEFAULT_ERROR_MODE env It is useful to help debugging crashes without opening debugger. --- atom/common/node_bindings.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 10da202da70d..dbd0bd8d96ee 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -14,6 +14,7 @@ #include "atom/common/node_includes.h" #include "base/command_line.h" #include "base/base_paths.h" +#include "base/environment.h" #include "base/files/file_path.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" @@ -141,6 +142,14 @@ void NodeBindings::Initialize() { // Init node. // (we assume node::Init would not modify the parameters under embedded mode). 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 env(base::Environment::Create()); + if (env->HasVar("ELECTRON_DEFAULT_ERROR_MODE")) + SetErrorMode(0); +#endif } node::Environment* NodeBindings::CreateEnvironment(