Skip to content
This repository was archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
fix windows crash reporting
Browse files Browse the repository at this point in the history
auditors @bbondy @darkdh
  • Loading branch information
bridiver committed Mar 28, 2017
1 parent 4c48270 commit 632be42
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions atom/app/atom_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <shellscalingapi.h>
#include <tchar.h>

#include "atom/common/crash_reporter/win/crash_service_main.h"
#include "base/environment.h"
#include "base/win/win_util.h"
#include "chrome/install_static/install_details.h"
#include "chrome/install_static/install_util.h"
Expand All @@ -29,6 +31,17 @@
#include "sandbox/win/src/sandbox_types.h"
#endif // defined(OS_WIN)

bool IsEnvSet(const char* name) {
#if defined(OS_WIN)
size_t required_size;
getenv_s(&required_size, nullptr, 0, name);
return required_size != 0;
#else
char* indicator = getenv(name);
return indicator && indicator[0] != '\0';
#endif
}

#if defined(OS_MACOSX)
extern "C" {
__attribute__((visibility("default")))
Expand All @@ -40,6 +53,10 @@ int ChromeMain(int argc, const char* argv[]);
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
int argc = 0;
wchar_t** argv_setup = ::CommandLineToArgvW(::GetCommandLineW(), &argc);

if (IsEnvSet("ELECTRON_INTERNAL_CRASH_SERVICE")) {
return crash_service::Main(cmd);
}
#else // OS_WIN
#if defined(OS_MACOSX)
int ChromeMain(int argc, const char* argv[]) {
Expand Down

0 comments on commit 632be42

Please sign in to comment.