This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
SV: END {} blocks run in perl_run
authorArthur Bergman <arthur@contiller.se>
Sun, 12 Aug 2001 00:34:28 +0000 (02:34 +0200)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 12 Aug 2001 17:10:22 +0000 (17:10 +0000)
Message-ID: <03fd01c122b5$c803c600$052aa8c0@foo>

p4raw-id: //depot/perl@11647

miniperlmain.c
perl.c

index 2c924eb..ee09fbe 100644 (file)
@@ -74,9 +74,12 @@ main(int argc, char **argv, char **env)
     exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
     if (!exitstatus) {
        exitstatus = perl_run(my_perl);
     exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
     if (!exitstatus) {
        exitstatus = perl_run(my_perl);
+       perl_destruct(my_perl);
+       exitstatus = STATUS_NATIVE_EXPORT;
+    } else {
+      perl_destruct(my_perl);
     }
 
     }
 
-    perl_destruct(my_perl);
     perl_free(my_perl);
 
     PERL_SYS_TERM();
     perl_free(my_perl);
 
     PERL_SYS_TERM();
diff --git a/perl.c b/perl.c
index 17fbac4..7a59772 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -398,9 +398,16 @@ perl_destruct(pTHXx)
 #endif
 
     LEAVE;
 #endif
 
     LEAVE;
+    {
+      dJMPENV;
+      int x = 0;
+      JMPENV_PUSH(x);
+      if (PL_endav && !PL_minus_c)
+       call_list(PL_scopestack_ix, PL_endav);
+      JMPENV_POP;
+    }
     FREETMPS;
 
     FREETMPS;
 
-
     /* We must account for everything.  */
 
     /* Destroy the main CV and syntax tree */
     /* We must account for everything.  */
 
     /* Destroy the main CV and syntax tree */
@@ -1499,8 +1506,6 @@ perl_run(pTHXx)
            LEAVE;
        FREETMPS;
        PL_curstash = PL_defstash;
            LEAVE;
        FREETMPS;
        PL_curstash = PL_defstash;
-       if (PL_endav && !PL_minus_c)
-           call_list(oldscope, PL_endav);
 #ifdef MYMALLOC
        if (PerlEnv_getenv("PERL_DEBUG_MSTATS"))
            dump_mstats("after execution:  ");
 #ifdef MYMALLOC
        if (PerlEnv_getenv("PERL_DEBUG_MSTATS"))
            dump_mstats("after execution:  ");