tools: improve error handling in node_mksnapshot

PR-URL: https://github.com/nodejs/node/pull/59437
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
James M Snell 2025-09-07 05:34:36 -07:00 committed by GitHub
parent 14c68e3b53
commit 840d05f8ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,8 +66,16 @@ int BuildSnapshot(int argc, char* argv[]) {
std::vector<std::string>(argv, argv + argc),
node::ProcessInitializationFlags::kGeneratePredictableSnapshot);
if (result->exit_code() != 0) {
for (const std::string& error : result->errors()) {
std::cerr << error << "\n";
}
std::cerr << "node_mksnapshot failed with exit code " << result->exit_code()
<< "\n";
return static_cast<int>(result->exit_code());
}
CHECK(!result->early_return());
CHECK_EQ(result->exit_code(), 0);
std::string out_path;
std::optional<std::string_view> builder_script_path = std::nullopt;