Commit f418c505 authored by Shenghou Ma's avatar Shenghou Ma

lib9/main.c: don't show the crash dialog on windows

Fixes #3202. (Or rather, work around issue 3202)

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7202053
parent 18178fd1
......@@ -27,11 +27,28 @@ THE SOFTWARE.
#define NOPLAN9DEFINES
#include <libc.h>
#ifdef WIN32
#include <windows.h>
static void crashhandler() {
fprint(2, "%s: internal fatal error.\n", argv0);
exit(1);
}
#endif
extern void p9main(int, char**);
int
main(int argc, char **argv)
{
#ifdef WIN32
signal(SIGSEGV, crashhandler);
signal(SIGBUS, crashhandler);
// don't display the crash dialog
DWORD mode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(mode | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
argv0 = argv[0];
#endif
p9main(argc, argv);
exits("main");
return 99;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment