From 1d20cef33e2fcc399b07df8795be84da9c09ccdc Mon Sep 17 00:00:00 2001 From: Michael Grupp Date: Mon, 10 Sep 2018 14:55:33 +0200 Subject: [PATCH] Check output stream in pbstream migration tool. (#1416) Avoids failing silently, e.g. when file permissions are lacking. --- cartographer/io/internal/pbstream_migrate.cc | 2 ++ cartographer/io/serialization_format_migration.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/cartographer/io/internal/pbstream_migrate.cc b/cartographer/io/internal/pbstream_migrate.cc index 59f1743..a84af06 100644 --- a/cartographer/io/internal/pbstream_migrate.cc +++ b/cartographer/io/internal/pbstream_migrate.cc @@ -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; } diff --git a/cartographer/io/serialization_format_migration.cc b/cartographer/io/serialization_format_migration.cc index c6fb7ce..558b45c 100644 --- a/cartographer/io/serialization_format_migration.cc +++ b/cartographer/io/serialization_format_migration.cc @@ -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);