Skip to content

Commit

Permalink
Don't error if worker runfiles aren't present (#892)
Browse files Browse the repository at this point in the history
This fixes an issue with rules_spm usage.
  • Loading branch information
brentleyjones authored Sep 1, 2022
1 parent 377c9bf commit 797aac6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tools/worker/worker_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
using bazel::tools::cpp::runfiles::Runfiles;

int main(int argc, char *argv[]) {
std::string error;
std::unique_ptr<Runfiles> runfiles(Runfiles::Create(argv[0], &error));
if (runfiles == nullptr) {
std::cerr << error << "\n";
return EXIT_FAILURE;
}

std::string index_import_path =
std::string index_import_path;
std::unique_ptr<Runfiles> runfiles(Runfiles::Create(argv[0]));
if (runfiles != nullptr) {
// We silently ignore errors here, we will report an error later if this
// path is accessed
index_import_path =
runfiles->Rlocation("build_bazel_rules_swift_index_import/index-import");
}

auto args = std::vector<std::string>(argv + 1, argv + argc);

Expand Down

0 comments on commit 797aac6

Please sign in to comment.