1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:30:03 -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
#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;