Catch errors during filesystem rewrite

This commit is contained in:
Marcus Holland-Moritz 2021-03-28 23:06:48 +02:00
parent 3cf157421d
commit 9ddd2a5d71

View File

@ -840,9 +840,10 @@ int mkdwarfs(int argc, char** argv) {
auto ti = LOG_TIMED_INFO;
try {
if (recompress) {
filesystem_v2::rewrite(lgr, prog, std::make_shared<dwarfs::mmap>(path), fsw,
rw_opts);
filesystem_v2::rewrite(lgr, prog, std::make_shared<dwarfs::mmap>(path),
fsw, rw_opts);
wg_compress.wait();
} else {
options.inode.with_similarity =
@ -852,10 +853,11 @@ int mkdwarfs(int argc, char** argv) {
options.file_order.mode == file_order_mode::NILSIMSA;
scanner s(lgr, wg_scanner, cfg, entry_factory::create(),
std::make_shared<os_access_posix>(), std::move(script), options);
std::make_shared<os_access_posix>(), std::move(script),
options);
try {
s.scan(fsw, path, prog);
}
} catch (runtime_error const& e) {
LOG_ERROR << e.what();
return 1;
@ -863,7 +865,6 @@ int mkdwarfs(int argc, char** argv) {
LOG_ERROR << e.what();
return 1;
}
}
ofs.close();