[pypy-svn] r17089 - pypy/dist/pypy/translator/c/src

arigo at codespeak.net arigo at codespeak.net
Tue Aug 30 17:56:34 CEST 2005


Author: arigo
Date: Tue Aug 30 17:56:32 2005
New Revision: 17089

Modified:
   pypy/dist/pypy/translator/c/src/main.h
Log:
Catch interp-level exceptions in main.h and display them as "fatal errors" (we
can only easily display their type, at the moment).  This used to just return
-1 as the exit code, which the OS interprets strangely.



Modified: pypy/dist/pypy/translator/c/src/main.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/main.h	(original)
+++ pypy/dist/pypy/translator/c/src/main.h	Tue Aug 30 17:56:32 2005
@@ -7,7 +7,7 @@
 int main(int argc, char *argv[])
 {
     char *errmsg = "out of memory";
-    int i;
+    int i, exitcode;
     RPyListOfString *list;
     errmsg = RPython_StartupCode();
     if (errmsg) goto error;
@@ -20,8 +20,14 @@
         _RPyListOfString_SetItem(list, i, s);
     }
 
-
-    return STANDALONE_ENTRY_POINT(list);
+    exitcode = STANDALONE_ENTRY_POINT(list);
+    if (RPyExceptionOccurred()) {
+        /* fish for the exception type, at least */
+        fprintf(stderr, "Fatal PyPy error: %s\n",
+                rpython_exc_type->ov_name->items);
+        exitcode = 1;
+    }
+    return exitcode;
 
  error:
     fprintf(stderr, "Fatal error during initialization: %s\n", errmsg);



More information about the Pypy-commit mailing list