btrbk: bugfix: print all errors if send/receive fails

If stream_compress is enabled and compress command is not found, we
now print "command not found".
pull/245/head
Axel Burri 2018-07-12 13:50:07 +02:00
parent 9aeaf2b15c
commit de57efff82
1 changed files with 6 additions and 11 deletions

17
btrbk
View File

@ -1422,17 +1422,12 @@ sub btrfs_send_receive($$$$)
$ret = $err; # print the errors below $ret = $err; # print the errors below
} }
if(defined($ret)) { if(defined($ret)) {
# NOTE: if "btrfs send" fails, "btrfs receive" returns 0! so we need to parse the output... # NOTE: btrfs-progs < 4.11: if "btrfs send" fails, "btrfs receive" returns 0! so we need to parse the output for "ERROR:" lines:
foreach(split("\n", $ret)) { my @ret_lines = split("\n", $ret);
if(/^ERROR: /) { $send_receive_error = 1 if(grep /^ERROR: /, @ret_lines);
ERROR $'; foreach(@ret_lines) {
$send_receive_error = 1; if(/^WARNING: / || $send_receive_error) {
} WARN "[send/receive] (send=$snapshot_path, receive=$target_path) $_";
elsif(/^WARNING: /) {
WARN "[send/receive] (send=$snapshot_path, receive=$target_path) $'";
}
else {
WARN "[send/receive] (send=$snapshot_path, receive=$target_path) $_" if($send_receive_error);
} }
} }
} }