[commit: ghc] master: sync-all: Skip END actions on exceptions (d523f9b)

git at git.haskell.org git at git.haskell.org
Sun Mar 23 00:40:03 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d523f9b3d4ce3463e8816cad2139ea397e00f8d1/ghc

>---------------------------------------------------------------

commit d523f9b3d4ce3463e8816cad2139ea397e00f8d1
Author: Florian Weimer <fw at deneb.enyo.de>
Date:   Thu Mar 13 10:23:56 2014 +0100

    sync-all: Skip END actions on exceptions
    
    Before this change, the END actions were executed even if the code
    throws an exception using "die".  This resulted in very confusing
    error reporting when an invalid command line option was specified.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

d523f9b3d4ce3463e8816cad2139ea397e00f8d1
 sync-all |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sync-all b/sync-all
index 4b4b7a3..70c9639 100755
--- a/sync-all
+++ b/sync-all
@@ -7,6 +7,7 @@ use English;
 $| = 1; # autoflush stdout after each print, to avoid output after die
 
 my $initial_working_directory;
+my $exit_via_die;
 
 my $defaultrepo;
 my @packages;
@@ -956,6 +957,11 @@ BEGIN {
     }
     $initial_working_directory = getcwd();
 
+    $SIG{__DIE__} = sub {
+      die @_ if $^S;
+      $exit_via_die = 1;
+    };
+
     #message "== Checking for left-over testsuite/.git folder";
     if (-d "testsuite/.git") {
         print <<EOF;
@@ -974,6 +980,7 @@ EOF
 }
 
 END {
+    return if $exit_via_die;
     my $ec = $?;
 
     chdir($initial_working_directory);



More information about the ghc-commits mailing list