Skip to content

Commit

Permalink
Log die message to the end after bsdcons has spamed the log file.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluhm committed Jun 13, 2023
1 parent 4dc423b commit 202a4e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
12 changes: 10 additions & 2 deletions Logcmd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ use File::Copy;
use POSIX;

use parent 'Exporter';
our @EXPORT= qw(createlog logmsg logeval runcmd forkcmd waitcmd logcmd loggrep);
our @EXPORT= qw(createlog relogdie logmsg logeval runcmd forkcmd waitcmd logcmd
loggrep);
use subs qw(logmsg);

my ($fh, $file, $verbose);
my ($fh, $file, $verbose, @diemsg);
sub createlog {
my %args = @_;
$file = $args{file};
Expand All @@ -39,10 +40,17 @@ sub createlog {

$SIG{__DIE__} = sub {
print $fh @_ if $fh;
@diemsg = @_;
die @_;
};
}

sub relogdie {
return unless @diemsg;
print $fh @diemsg if $fh;
print @diemsg if $verbose;
}

sub logmsg {
print $fh @_ if $fh;
print @_ if $verbose;
Expand Down
7 changes: 5 additions & 2 deletions once.pl
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@
# do not run end block until initialized, date may change later
my $odate = $date;
END {
bsdcons_hosts(cvsdate => $cvsdate, patch => $patch, modify => $modify,
release => $release) if $odate;
if ($odate) {
bsdcons_hosts(cvsdate => $cvsdate, patch => $patch, modify => $modify,
release => $release);
relogdie();
}
my @cmd = ("$performdir/bin/setup-html.pl");
system(@cmd) if $performdir;
@cmd = ("$performdir/bin/running-html.pl");
Expand Down
5 changes: 4 additions & 1 deletion run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@
# do not run end block until initialized, date may change later
my $odate = $date;
END {
bsdcons_hosts() if $odate;
if ($odate) {
bsdcons_hosts();
relogdie();
}
my @cmd = ("$regressdir/bin/setup-html.pl");
system(@cmd) if $regressdir;
@cmd = ("$regressdir/bin/running-html.pl");
Expand Down
5 changes: 4 additions & 1 deletion step.pl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@
# do not run end block until initialized, date may change later
my $odate = $date;
END {
bsdcons_hosts(release => $release) if $odate;
if ($odate) {
bsdcons_hosts(release => $release);
relogdie();
}
my @cmd = ("$performdir/bin/setup-html.pl");
system(@cmd) if $performdir;
@cmd = ("$performdir/bin/running-html.pl");
Expand Down

0 comments on commit 202a4e3

Please sign in to comment.