1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:54:59 -07:00

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
This commit is contained in:
Shenghou Ma 2013-02-03 06:11:25 +08:00
parent 18178fd138
commit f418c505d0

View File

@ -27,11 +27,28 @@ THE SOFTWARE.
#define NOPLAN9DEFINES #define NOPLAN9DEFINES
#include <libc.h> #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**); extern void p9main(int, char**);
int int
main(int argc, char **argv) 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); p9main(argc, argv);
exits("main"); exits("main");
return 99; return 99;