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>
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
$::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 ($) {