From 56f97b5bd28e6ebc372bfe61a10ca4572c6ed823 Mon Sep 17 00:00:00 2001 From: Christoph Klaffl Date: Thu, 6 Jun 2019 08:09:42 +0200 Subject: [PATCH] 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) --- syncoid | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/syncoid b/syncoid index e41a940..29b7319 100755 --- a/syncoid +++ b/syncoid @@ -526,9 +526,18 @@ sub syncdataset { if (!$quiet) { print "Resuming interrupted zfs send/receive from $sourcefs to $targetfs (~ $disp_pvsize remaining):\n"; } if ($debug) { print "DEBUG: $synccmd\n"; } - ($stdout, $exit) = tee_stdout { - system("$synccmd") - }; + if ($pvsize == 0) { + # 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 { if ($stdout =~ /\Qused in the initial send no longer exists\E/) {