summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/TARGETS1
-rw-r--r--src/other_tools/just_mr/main.cpp10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS
index 02876feb..9bd70659 100644
--- a/src/other_tools/just_mr/TARGETS
+++ b/src/other_tools/just_mr/TARGETS
@@ -19,6 +19,7 @@
, ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/just_mr/progress_reporting", "statistics"]
, ["src/other_tools/just_mr/progress_reporting", "progress_reporter"]
+ , ["src/buildtool/storage", "storage"]
]
, "stage": ["src", "other_tools", "just_mr"]
, "private-ldflags":
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index 56ba4a18..e331a063 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -24,6 +24,7 @@
#include "src/buildtool/logging/log_sink_cmdline.hpp"
#include "src/buildtool/logging/log_sink_file.hpp"
#include "src/buildtool/main/version.hpp"
+#include "src/buildtool/storage/garbage_collector.hpp"
#include "src/other_tools/just_mr/cli.hpp"
#include "src/other_tools/just_mr/exit_codes.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
@@ -1276,9 +1277,14 @@ void DefaultReachableRepositories(
bool supports_defines{false};
std::optional<std::filesystem::path> mr_config_path{std::nullopt};
+ std::optional<LockFile> lock{};
if (subcommand and kKnownJustSubcommands.contains(*subcommand)) {
// Read the config file if needed
if (kKnownJustSubcommands.at(*subcommand).config) {
+ lock = GarbageCollector::SharedLock();
+ if (not lock) {
+ return kExitGenericFailure;
+ }
auto config = ReadConfiguration(config_file);
use_config = true;
@@ -1502,6 +1508,10 @@ auto main(int argc, char* argv[]) -> int {
arguments.cmd == SubCommand::kJustSubCmd) {
return CallJust(config_file, arguments, forward_build_root);
}
+ auto lock = GarbageCollector::SharedLock();
+ if (not lock) {
+ return kExitGenericFailure;
+ }
// The remaining options all need the config file
auto config = ReadConfiguration(config_file);