@@ -161,7 +161,9 @@ TEST(Utl, stream_handler_write_and_read_gzip)
161161TEST (Utl, stream_handler_temp_file_handling)
162162{
163163 const char * filename = " test_temp_file_handling.txt" ;
164- std::string tmp_filename = std::string (filename) + " .1" ;
164+ const auto pid = static_cast <unsigned int >(::getpid ());
165+ std::string tmp_filename
166+ = std::string (filename) + " ." + std::to_string (pid) + " .1" ;
165167
166168 // Check that the temp file is created
167169 {
@@ -184,7 +186,9 @@ TEST(Utl, stream_handler_exception_handling)
184186 OutStreamHandler sh (filename);
185187 throw std::runtime_error (" Simulated exception" );
186188 } catch (...) {
187- std::string tmp_filename = std::string (filename) + " .1" ;
189+ auto pid = static_cast <unsigned int >(::getpid ());
190+ std::string tmp_filename
191+ = std::string (filename) + " ." + std::to_string (pid) + " .1" ;
188192 // Ensure temporary file is cleaned up
189193 EXPECT_TRUE (!std::filesystem::exists (tmp_filename));
190194 // Original file should exist
@@ -214,7 +218,9 @@ TEST(Utl, file_handler_write_and_read)
214218TEST (Utl, file_handler_temp_file_handling)
215219{
216220 const char * filename = " test_temp_file_handling_file.txt" ;
217- std::string tmp_filename = std::string (filename) + " .1" ;
221+ const auto pid = static_cast <unsigned int >(::getpid ());
222+ std::string tmp_filename
223+ = std::string (filename) + " ." + std::to_string (pid) + " .1" ;
218224
219225 // Check that the temp file is created
220226 {
0 commit comments