aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/dedup_cmd.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
committerStefan Boberg <[email protected]>2026-04-23 18:16:57 +0200
commit0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch)
tree94730e7594fd09ae1fa820391ce311f6daf13905 /src/zen/cmds/dedup_cmd.cpp
parentFix forward declaration order for s_GotSigWinch and SigWinchHandler (diff)
parenttrace: declare Region event name fields as AnsiString (#1012) (diff)
downloadarchived-zen-sb/zen-help.tar.xz
archived-zen-sb/zen-help.zip
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher - Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zen/cmds/dedup_cmd.cpp')
-rw-r--r--src/zen/cmds/dedup_cmd.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/zen/cmds/dedup_cmd.cpp b/src/zen/cmds/dedup_cmd.cpp
index 9ef50a97d..18ad56aec 100644
--- a/src/zen/cmds/dedup_cmd.cpp
+++ b/src/zen/cmds/dedup_cmd.cpp
@@ -240,7 +240,12 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
zen::BLAKE3Stream b3s;
- zen::ScanFile(Entry.path(), 64 * 1024, [&](const void* Data, size_t Size) { b3s.Append(Data, Size); });
+ if (std::error_code ScanEc =
+ zen::ScanFile(Entry.path(), 64 * 1024, [&](const void* Data, size_t Size) { b3s.Append(Data, Size); });
+ ScanEc)
+ {
+ throw std::system_error(ScanEc, fmt::format("Failed to scan file '{}'", Entry.path()));
+ }
Hash = b3s.GetHash();
}
@@ -279,7 +284,11 @@ DedupCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
Options.EnableClone = true;
Options.MustClone = true;
- zen::CopyFile(Dupe->path(), Entry.path(), Options);
+ if (std::error_code Ec = zen::CopyFile(Dupe->path(), Entry.path(), Options); Ec)
+ {
+ ZEN_ERROR("Failed to clone '{}' to '{}': {}", Dupe->path(), Entry.path(), Ec.message());
+ continue;
+ }
DupeBytes += Entry.file_size();
}