diff options
author | Ian Lynagh <igloo@earth.li> | 2007-08-03 18:32:29 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-08-03 18:32:29 +0000 |
commit | 0f15d797ceee52ae8fa507500d1119cc9638431a (patch) | |
tree | 5aa90abda5bc2580b19848290cf75e5b7a6bc1d6 /rts/Main.c | |
parent | 3042a5bd1fdb5a8484e3363e66e84a9cce4f02b5 (diff) | |
download | haskell-0f15d797ceee52ae8fa507500d1119cc9638431a.tar.gz |
Catch exceptions on Windows, to stop it popping up dialog boxes
Adaptated from code from Sigbjorn Finne
Diffstat (limited to 'rts/Main.c')
-rw-r--r-- | rts/Main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/Main.c b/rts/Main.c index 745d7759de..5f16fa344a 100644 --- a/rts/Main.c +++ b/rts/Main.c @@ -16,6 +16,7 @@ #include "RtsUtils.h" #include "Prelude.h" #include "Task.h" +#include "seh_excn.h" #include <stdlib.h> #ifdef DEBUG @@ -48,6 +49,7 @@ int main(int argc, char *argv[]) SchedulerStatus status; /* all GranSim/GUM init is done in startupHaskell; sets IAmMainThread! */ + BEGIN_CATCH startupHaskell(argc,argv,__stginit_ZCMain); /* kick off the computation by creating the main thread with a pointer @@ -133,6 +135,8 @@ int main(int argc, char *argv[]) barf("main thread completed with invalid status"); } shutdownHaskellAndExit(exit_status); - return 0; /* never reached, keep gcc -Wall happy */ + END_CATCH + return 0; /* not reached unless a Windows exception happens, + also keeps gcc -Wall happy */ } # endif /* BATCH_MODE */ |