@@ -122,7 +122,7 @@ class tempdb_t
122122 " Test database cannot be created: {}\n "
123123 " Did you mean to run 'pg_virtualenv ctest'?\n " ,
124124 e.what ());
125- std::exit (1 );
125+ std::exit (1 ); // NOLINT(concurrency-mt-unsafe)
126126 }
127127 }
128128
@@ -134,22 +134,25 @@ class tempdb_t
134134
135135 ~tempdb_t () noexcept
136136 {
137- if (!m_db_name.empty ()) {
138- // Disable removal of the test database by setting the environment
139- // variable OSM2PGSQL_KEEP_TEST_DB to anything. This can be useful
140- // when debugging tests.
141- char const *const keep_db = std::getenv (" OSM2PGSQL_KEEP_TEST_DB" );
142- if (keep_db != nullptr ) {
143- return ;
144- }
145- try {
146- connection_params_t connection_params;
147- connection_params.set (" dbname" , " postgres" );
148- conn_t const conn{connection_params};
149- conn.exec (R"( DROP DATABASE IF EXISTS "{}")" , m_db_name);
150- } catch (...) {
151- fprintf (stderr, " DROP DATABASE failed. Ignored.\n " );
152- }
137+ if (m_db_name.empty ()) {
138+ return ;
139+ }
140+
141+ // Disable removal of the test database by setting the environment
142+ // variable OSM2PGSQL_KEEP_TEST_DB to anything. This can be useful
143+ // when debugging tests.
144+ // NOLINTNEXTLINE(concurrency-mt-unsafe)
145+ char const *const keep_db = std::getenv (" OSM2PGSQL_KEEP_TEST_DB" );
146+ if (keep_db != nullptr ) {
147+ return ;
148+ }
149+ try {
150+ connection_params_t connection_params;
151+ connection_params.set (" dbname" , " postgres" );
152+ conn_t const conn{connection_params};
153+ conn.exec (R"( DROP DATABASE IF EXISTS "{}")" , m_db_name);
154+ } catch (...) {
155+ fmt::print (stderr, " DROP DATABASE failed. Ignored.\n " );
153156 }
154157 }
155158
0 commit comments