@@ -14,20 +14,21 @@ namespace checker {
1414
1515// detect flag
1616constexpr std::string D2X_WAIT = " D2X_WAIT" ;
17- static auto btools = d2x::load_buildtools();
1817
19- std::pair<bool , std::string> build_with_error_handling (const std::string &target) {
18+ std::pair<bool , std::string> build_with_error_handling (const auto & btools, const std::string &target) {
2019 auto [exit_code, output] = btools.build (target);
2120 return std::make_pair (exit_code == 0 , output);
2221}
2322
24- std::pair<bool , std::string> run_with_error_handling (const std::string &target) {
23+ std::pair<bool , std::string> run_with_error_handling (const auto & btools, const std::string &target) {
2524 auto [exit_code, output] = btools.run (target);
2625 return std::make_pair (exit_code == 0 , output);
2726}
2827
2928export void run (const std::string& start_target = " " ) {
3029
30+ auto btools = d2x::load_buildtools ();
31+
3132 btools.load_targets ();
3233
3334 auto targets = btools.get_targets ();
@@ -78,10 +79,10 @@ export void run(const std::string& start_target = "") {
7879
7980 while (!build_success) {
8081
81- std::tie (build_success, output) = build_with_error_handling (target);
82+ std::tie (build_success, output) = build_with_error_handling (btools, target);
8283
8384 if (build_success) {
84- std::tie (build_success, output) = run_with_error_handling (target);
85+ std::tie (build_success, output) = run_with_error_handling (btools, target);
8586 }
8687
8788 status = build_success;
0 commit comments