1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-02 23:20: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)
{
try {
std::filesystem::create_symlink(target, link);
} catch (std::filesystem::filesystem_error & e) {
throw SysError("creating symlink '%1%' -> '%2%'", link, target);
}
std::error_code ec;
std::filesystem::create_symlink(target, link, ec);
if (ec)
throw SysError(ec.value(), "creating symlink '%1%' -> '%2%'", link, target);
}
void replaceSymlink(const std::filesystem::path & target, const std::filesystem::path & link)