chiark / gitweb /
Dgit.pm: Provide failmsg, previously buried in fail
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 21:46:04 +0000 (22:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 16 Jun 2018 22:25:50 +0000 (23:25 +0100)
Most of `fail' is error message construction.  This change allows
callers to do something other with the message, than pass it to die.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm

index d5834176686b80ff6c9c6541d0fbdfdb39ea50af..3202180587105a7f039278379978b0acd33e0741 100644 (file)
@@ -44,7 +44,7 @@ BEGIN {
                      server_branch server_ref
                       stat_exists link_ltarget
                      hashfile
-                      fail ensuredir must_getcwd executable_on_path
+                      fail failmsg ensuredir must_getcwd executable_on_path
                       waitstatusmsg failedcmd_waitstatus
                      failedcmd_report_cmd failedcmd
                       runcmd cmdoutput cmdoutput_errok
@@ -221,12 +221,16 @@ sub _us () {
     $::us // ($0 =~ m#[^/]*$#, $&);
 }
 
-sub fail { 
+sub failmsg {
     my $s = "@_\n";
     $s =~ s/\n\n$/\n/;
     my $prefix = _us().": ";
     $s =~ s/^/$prefix/gm;
-    die $s;
+    return $s;
+}
+
+sub fail {
+    die failmsg @_;
 }
 
 sub ensuredir ($) {