Skip to content

Commit

Permalink
fix: report only error codes from buildozer
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 14, 2023
1 parent d6413e3 commit 1ddbf7e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions bzlmod/add_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,38 @@ auto bzlmod::add_module( //

std::cout << "Found version for " << dep_name << ": " << *dep_version << "\n";

// We don't care if this fails
bp::child{
bp::exe(buildozer),
bp::args({
std::format("new bazel_dep {}", dep_name),
"//MODULE.bazel:all",
}),
}.wait();

bp::std_out > bp::null,
bp::std_err > bp::null,
}
.wait();

bp::child{
auto buildozer_proc = bp::child{
bp::exe(buildozer),
bp::args({
std::format("set version {}", *dep_version),
std::format("//MODULE.bazel:{}", dep_name),
}),
}.wait();
bp::std_out > bp::null,
bp::std_err > bp::null,
};

buildozer_proc.wait();

auto buildozer_exit_code = buildozer_proc.exit_code();
if(buildozer_exit_code != 0 && buildozer_exit_code != 3) {
std::cerr << std::format( //
"buildozer exited with {}\n",
buildozer_proc.exit_code()
);
return 1;
}

return 0;
}

0 comments on commit 1ddbf7e

Please sign in to comment.