fixed crahs handler for linux
This commit is contained in:
parent
4965c080ce
commit
bbeeecbc61
@ -62,6 +62,7 @@ bool rename_or_move(const fs::path& source, const fs::path& target, std::string&
|
||||
}
|
||||
|
||||
void crash_execute_detached(const std::string& command_line) {
|
||||
cout << "Exec command " << command_line << endl;
|
||||
#ifdef WIN32
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
@ -94,8 +95,11 @@ void crash_execute_detached(const std::string& command_line) {
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/* we want to prevent allocations while we're within a crash */
|
||||
const static std::string _message_fail = "failed write crash dump";
|
||||
const static std::string _message_success;
|
||||
bool breakpad_crash_callback(const google_breakpad::MinidumpDescriptor& descriptor, void* _context, bool succeeded) {
|
||||
return crash_callback(descriptor.path(), crash_context.get(), succeeded ? "" : "failed write crash dump", succeeded);
|
||||
return crash_callback(descriptor.path(), &*crash_context, succeeded ? _message_success : _message_fail, succeeded);
|
||||
}
|
||||
#else
|
||||
extern LONG WINAPI unhandled_handler(struct _EXCEPTION_POINTERS* apExceptionInfo);
|
||||
@ -150,12 +154,12 @@ bool crash_callback(const fs::path& source_file, CrashContext* context, const st
|
||||
bool signal::setup(std::unique_ptr<CrashContext>& context) {
|
||||
|
||||
#ifndef WIN32
|
||||
global_crash_handler = make_unique<google_breakpad::ExceptionHandler>(google_breakpad::MinidumpDescriptor("/tmp"), nullptr, breakpad_crash_callback, context.release(), true, -1);
|
||||
global_crash_handler = make_unique<google_breakpad::ExceptionHandler>(google_breakpad::MinidumpDescriptor("/tmp"), nullptr, breakpad_crash_callback, nullptr, true, -1);
|
||||
#else
|
||||
//SetUnhandledExceptionFilter(unhandled_handler);
|
||||
global_crash_handler = AddVectoredExceptionHandler(0, unhandled_handler); /* this only works! */
|
||||
#endif
|
||||
crash_context = move(context);
|
||||
crash_context = move(context);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
//__filename
|
||||
|
||||
module.paths.push("../../build/linux_amd64");
|
||||
module.paths.push("../../build/linux_x64");
|
||||
module.paths.push("../../build/win32_64");
|
||||
|
||||
const electron = require("electron");
|
||||
const crash_handler = require("teaclient_crash_handler");
|
||||
|
||||
if(process.argv.length != 2) {
|
||||
if(process.argv.length != 3) {
|
||||
electron.app.on('ready', () => {
|
||||
console.log("SHow dialog");
|
||||
electron.dialog.showMessageBox({
|
||||
|
Loading…
Reference in New Issue
Block a user