fix: crash dump location on Linux (#31668)

* fix: crash dump location on Linux

* fix: ignore client_id for Zygote process

* chore: update comment

Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
Shelley Vohr 2021-11-04 18:45:59 +01:00 committed by GitHub
parent b6b9cec604
commit 96a04c67fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -127,11 +127,7 @@ bool ElectronPathProvider(int key, base::FilePath* result) {
case DIR_CRASH_DUMPS: case DIR_CRASH_DUMPS:
if (!base::PathService::Get(chrome::DIR_USER_DATA, &cur)) if (!base::PathService::Get(chrome::DIR_USER_DATA, &cur))
return false; return false;
#if defined(OS_MAC) || defined(OS_WIN)
cur = cur.Append(FILE_PATH_LITERAL("Crashpad")); cur = cur.Append(FILE_PATH_LITERAL("Crashpad"));
#else
cur = cur.Append(FILE_PATH_LITERAL("Crash Reports"));
#endif
create_dir = true; create_dir = true;
break; break;
case chrome::DIR_APP_DICTIONARIES: case chrome::DIR_APP_DICTIONARIES:

View file

@ -559,7 +559,11 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
enable_crash_reporter = breakpad::IsCrashReporterEnabled(); enable_crash_reporter = breakpad::IsCrashReporterEnabled();
} }
if (enable_crash_reporter) { // Zygote Process gets booted before any JS runs, accessing GetClientId
// will end up touching DIR_USER_DATA path provider and this will
// configure default value because app.name from browser_init has
// not run yet.
if (enable_crash_reporter && process_type != ::switches::kZygoteProcess) {
std::string switch_value = std::string switch_value =
api::crash_reporter::GetClientId() + ",no_channel"; api::crash_reporter::GetClientId() + ",no_channel";
command_line->AppendSwitchASCII(::switches::kEnableCrashReporter, command_line->AppendSwitchASCII(::switches::kEnableCrashReporter,