Check output stream in pbstream migration tool. (#1416)

Avoids failing silently, e.g. when file permissions are lacking.
master
Michael Grupp 2018-09-10 14:55:33 +02:00 committed by Wally B. Feed
parent 1ddfd9c6d3
commit 1d20cef33e
2 changed files with 3 additions and 0 deletions

View File

@ -48,6 +48,8 @@ int pbstream_migrate(int argc, char** argv) {
<< "\" to new serialization format in \"" << argv[3] << "\""; << "\" to new serialization format in \"" << argv[3] << "\"";
cartographer::io::MigrateStreamFormatToVersion1(&input, &output, cartographer::io::MigrateStreamFormatToVersion1(&input, &output,
FLAGS_migrate_grid_format); FLAGS_migrate_grid_format);
CHECK(output.Close()) << "Could not write migrated pbstream file to: "
<< argv[3];
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -278,6 +278,7 @@ void SerializeToVersion1Format(
SerializedData::kFixedFramePoseDataFieldNumber, SerializedData::kFixedFramePoseDataFieldNumber,
SerializedData::kLandmarkDataFieldNumber}; SerializedData::kLandmarkDataFieldNumber};
LOG(INFO) << "Writing proto stream.";
output->WriteProto(CreateSerializationHeader()); output->WriteProto(CreateSerializationHeader());
for (auto field_index : kFieldSerializationOrder) { for (auto field_index : kFieldSerializationOrder) {
const auto proto_vector_it = deserialized_data.find(field_index); const auto proto_vector_it = deserialized_data.find(field_index);