only print stderr output of failed listing command with --debug flag

This commit is contained in:
Christoph Klaffl 2020-01-16 18:10:20 +01:00
parent 3b18948f29
commit 28ef311ba5
No known key found for this signature in database
GPG Key ID: 8FC1D76EED4970D2
1 changed files with 7 additions and 2 deletions

View File

@ -1455,8 +1455,13 @@ sub getsnaps() {
$fsescaped = escapeshellparam($fsescaped);
}
my $getsnapcmd = "$rhost $mysudocmd $zfscmd get -Hpd 1 -t snapshot guid,creation $fsescaped |";
if ($debug) { print "DEBUG: getting list of snapshots on $fs using $getsnapcmd...\n"; }
my $getsnapcmd = "$rhost $mysudocmd $zfscmd get A-Hpd 1 -t snapshot guid,creation $fsescaped";
if ($debug) {
$getsnapcmd = "$getsnapcmd |";
print "DEBUG: getting list of snapshots on $fs using $getsnapcmd...\n";
} else {
$getsnapcmd = "$getsnapcmd 2>/dev/null |";
}
open FH, $getsnapcmd;
my @rawsnaps = <FH>;
close FH or do {