File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
test-support/src/main/java/org/jabref/support Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11package org .jabref .support ;
22
3+ import java .io .IOException ;
34import java .sql .Connection ;
45import java .sql .Statement ;
56
@@ -25,6 +26,16 @@ public static synchronized DataSource getDataSource() throws Exception {
2526 }
2627 // Pre-populate once so parallel test workers never race on table creation
2728 JournalAbbreviationLoader .loadBuiltInRepository (dataSource );
29+
30+ // Stop the embedded Postgres instance when the JVM shuts down
31+ final EmbeddedPostgres pgToClose = pg ;
32+ Runtime .getRuntime ().addShutdownHook (new Thread (() -> {
33+ try {
34+ pgToClose .close ();
35+ } catch (IOException e ) {
36+ // best effort cleanup
37+ }
38+ }));
2839 }
2940 return dataSource ;
3041 }
You can’t perform that action at this time.
0 commit comments