capture the stderr of zfs send command in the case of a resumed replication where the send size can't be estimated (in which case pv is not working anyway, so we can break the interactivitiy)

This commit is contained in:
Christoph Klaffl 2019-06-06 08:09:42 +02:00
parent 22fe41cb11
commit 56f97b5bd2
No known key found for this signature in database
GPG Key ID: 8FC1D76EED4970D2
1 changed files with 12 additions and 3 deletions

15
syncoid
View File

@ -526,9 +526,18 @@ sub syncdataset {
if (!$quiet) { print "Resuming interrupted zfs send/receive from $sourcefs to $targetfs (~ $disp_pvsize remaining):\n"; } if (!$quiet) { print "Resuming interrupted zfs send/receive from $sourcefs to $targetfs (~ $disp_pvsize remaining):\n"; }
if ($debug) { print "DEBUG: $synccmd\n"; } if ($debug) { print "DEBUG: $synccmd\n"; }
($stdout, $exit) = tee_stdout { if ($pvsize == 0) {
system("$synccmd") # we need to capture the error of zfs send, this will render pv useless but in this case
}; # it doesn't matter because we don't know the estimated send size (probably because
# the initial snapshot used for resumed send doesn't exist anymore)
($stdout, $exit) = tee_stderr {
system("$synccmd")
};
} else {
($stdout, $exit) = tee_stdout {
system("$synccmd")
};
}
$exit == 0 or do { $exit == 0 or do {
if ($stdout =~ /\Qused in the initial send no longer exists\E/) { if ($stdout =~ /\Qused in the initial send no longer exists\E/) {