diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-07-01 11:12:30 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-07-01 12:10:42 +0200 |
commit | bea9f58950be873efd339835616e3d3499d7e45a (patch) | |
tree | 99347e5a1428e92debf670498cc07bcfd754ee3c /src | |
parent | 327ea702ffcfcf7a8103da5adb2075cd6cfdc5f0 (diff) | |
download | justbuild-bea9f58950be873efd339835616e3d3499d7e45a.tar.gz |
just-mr: Fix lifetime of Git CAS lock
If calling just, the shared Git CAS lock, if taken, now lasts past
the exec call, the same way as the CAS lock does, in order to
prevent any rotation taking place in between.
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index c085f5be..b1b918b2 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -91,13 +91,15 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, std::optional<std::pair<std::filesystem::path, std::string>> mr_config_pair{ std::nullopt}; + // If gc locks are needed, ensure to keep them alive also for the exec call std::optional<LockFile> lock{}; + std::optional<LockFile> repo_lock{}; + if (subcommand and kKnownJustSubcommands.contains(*subcommand)) { auto const& flags = kKnownJustSubcommands.at(*subcommand); // Read the config file if needed if (flags.config) { - auto repo_lock = - RepositoryGarbageCollector::SharedLock(storage_config); + repo_lock = RepositoryGarbageCollector::SharedLock(storage_config); if (not repo_lock) { return kExitGenericFailure; } |