1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 15:40:59 +01:00

libutil: Propagate error code in createSymlink

(cherry picked from commit bf7c53f2d3)
This commit is contained in:
Sergei Zimmerman 2025-12-01 03:00:45 +03:00 committed by github-actions[bot]
parent 3e50cadbe6
commit fb79e6a7a1

View file

@ -730,11 +730,10 @@ Path makeTempPath(const Path & root, const Path & suffix)
void createSymlink(const Path & target, const Path & link) void createSymlink(const Path & target, const Path & link)
{ {
try { std::error_code ec;
std::filesystem::create_symlink(target, link); std::filesystem::create_symlink(target, link, ec);
} catch (std::filesystem::filesystem_error & e) { if (ec)
throw SysError("creating symlink '%1%' -> '%2%'", link, target); throw SysError(ec.value(), "creating symlink '%1%' -> '%2%'", link, target);
}
} }
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link) void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)