Commit c0282e9f authored by Nigel Kukard's avatar Nigel Kukard

Added history display if file load fails

parent c67b9fea
......@@ -226,6 +226,7 @@ sub loadFile
# Loop again with each line number
my $line_current = 0;
my $percent_last = "";
my @history = ();
while (my $cmdline = <$FH>) {
# Bump line number
$line_current++;
......@@ -246,9 +247,21 @@ sub loadFile
# Process
if ((my $res = processCommand($OUT,$cmdline)) < 0) {
print($OUT " => Failed to execute command on line $line_current: $cmdline\n");
# List last 5 success lines
foreach my $line (@history) {
print($OUT " => SUCCESS: $line\n");
}
# Lastly list the failure
print($OUT " => FAILURE: $cmdline\n");
return $res;
}
# Store history so we can give better errors
push(@history,$cmdline);
# Store only 5 lines of history
if (@history > 5) {
shift(@history);
}
}
# Close
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment