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/9a63944a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9a63944a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9a63944a

Branch: refs/heads/master
Commit: 9a63944ac39216380f4bafa0d1c58fbd91439313
Parents: c8a9224
Author: Nick Wellnhofer <[email protected]>
Authored: Thu Jan 21 17:37:51 2016 +0100
Committer: Nick Wellnhofer <[email protected]>
Committed: Thu Jan 21 17:53:17 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/9a63944a/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 7d55bb4..0159b0f 100644
--- a/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
+++ b/compiler/perl/lib/Clownfish/CFC/Perl/Build/Charmonic.pm
@@ -92,7 +92,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