Rerun charmonizer with CHARM_VERBOSITY=2 after failure

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/03b9124b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/03b9124b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/03b9124b

Branch: refs/heads/0.4
Commit: 03b9124b92673f885de1d0a350046d31627c117f
Parents: f93c813
Author: Nick Wellnhofer <[email protected]>
Authored: Thu Jan 21 17:37:51 2016 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Thu Jan 21 17:37:51 2016 +0100

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/03b9124b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm 
b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
index 5f69d13..b7feffa 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
@@ -91,7 +91,17 @@ sub ACTION_charmony {
     }
     print join( " ", @command ), $/;
 
-    system(@command) and die "Failed to run $CHARMONIZER_EXE_PATH: $!";
+    if ( system(@command) != 0 ) {
+        warn "Failed to run $CHARMONIZER_EXE_PATH: $!\n";
+
+        if ( ( $ENV{CHARM_VERBOSITY} || 0 ) < 2 ) {
+            print "Rerunning $CHARMONIZER_EXE_PATH with CHARM_VERBOSITY=2\n\n";
+            $ENV{CHARM_VERBOSITY} = 2;
+            system(@command);
+        }
+
+        die "Aborted";
+    }
 }
 
 my $config;

Reply via email to