diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-11-21 20:03:20 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-11-21 20:06:22 +0100 |
commit | e10e57b67c00b31b595fb92e83da8bebd8943550 (patch) | |
tree | 1810bb4bed2157a1e2497e1478cf76dcf1bf6539 /lib | |
parent | 654740fd9cecce9921d274246791eb0cbc723af0 (diff) | |
download | App-BorgRestore-e10e57b67c00b31b595fb92e83da8bebd8943550.tar.gz App-BorgRestore-e10e57b67c00b31b595fb92e83da8bebd8943550.tar.xz |
Borg::list_archive: Use --format to please borg 1.1
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App/BorgRestore/Borg.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm index bd9ac3c..3e531ba 100644 --- a/lib/App/BorgRestore/Borg.pm +++ b/lib/App/BorgRestore/Borg.pm @@ -107,7 +107,14 @@ method restore($components_to_strip, $archive_name, $path) { method list_archive($archive, $cb) { $log->debugf("Fetching file list for archive %s", $archive); - open (my $fh, '-|', 'borg', qw/list --list-format/, '{isomtime} {path}{NEWLINE}', $self->{borg_repo}."::".$archive); + my $fh; + + if (Version::Compare::version_compare($self->{borg_version}, "1.1") >= 0) { + open ($fh, '-|', 'borg', qw/list --format/, '{isomtime} {path}{NEWLINE}', $self->{borg_repo}."::".$archive); + } else { + open ($fh, '-|', 'borg', qw/list --list-format/, '{isomtime} {path}{NEWLINE}', $self->{borg_repo}."::".$archive); + } + while (<$fh>) { $cb->($_); } |