Skip to content

Commit

Permalink
Check output stream in pbstream migration tool. (#1416)
Browse files Browse the repository at this point in the history
Avoids failing silently, e.g. when file permissions are lacking.
  • Loading branch information
MichaelGrupp authored and wally-the-cartographer committed Sep 10, 2018
1 parent 1ddfd9c commit 1d20cef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cartographer/io/internal/pbstream_migrate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ int pbstream_migrate(int argc, char** argv) {
<< "\" to new serialization format in \"" << argv[3] << "\"";
cartographer::io::MigrateStreamFormatToVersion1(&input, &output,
FLAGS_migrate_grid_format);
CHECK(output.Close()) << "Could not write migrated pbstream file to: "
<< argv[3];

return EXIT_SUCCESS;
}
Expand Down
1 change: 1 addition & 0 deletions cartographer/io/serialization_format_migration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ void SerializeToVersion1Format(
SerializedData::kFixedFramePoseDataFieldNumber,
SerializedData::kLandmarkDataFieldNumber};

LOG(INFO) << "Writing proto stream.";
output->WriteProto(CreateSerializationHeader());
for (auto field_index : kFieldSerializationOrder) {
const auto proto_vector_it = deserialized_data.find(field_index);
Expand Down

0 comments on commit 1d20cef

Please sign in to comment.