Skip to content

Commit 797aac6

Browse files
Don't error if worker runfiles aren't present (#892)
This fixes an issue with rules_spm usage.
1 parent 377c9bf commit 797aac6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/worker/worker_main.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@
2424
using bazel::tools::cpp::runfiles::Runfiles;
2525

2626
int main(int argc, char *argv[]) {
27-
std::string error;
28-
std::unique_ptr<Runfiles> runfiles(Runfiles::Create(argv[0], &error));
29-
if (runfiles == nullptr) {
30-
std::cerr << error << "\n";
31-
return EXIT_FAILURE;
32-
}
33-
34-
std::string index_import_path =
27+
std::string index_import_path;
28+
std::unique_ptr<Runfiles> runfiles(Runfiles::Create(argv[0]));
29+
if (runfiles != nullptr) {
30+
// We silently ignore errors here, we will report an error later if this
31+
// path is accessed
32+
index_import_path =
3533
runfiles->Rlocation("build_bazel_rules_swift_index_import/index-import");
34+
}
3635

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

0 commit comments

Comments
 (0)