postgresql-embedded icon indicating copy to clipboard operation
postgresql-embedded copied to clipboard

Default temp directory not deleted on exit

Open jeremiehuchet opened this issue 7 years ago • 2 comments
trafficstars

The default directory where the postgres binary is extracted is not deleted on exit despite of the following line: https://github.com/yandex-qatools/postgresql-embedded/blob/a47e90f5da76a8bc21bb4ce946e8706373f451b6/src/main/java/ru/yandex/qatools/embed/postgresql/ext/SubdirTempDir.java#L27

File#deleteOnExit() documentation refers to File#delete() and the latter says:

Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted

I expect the temp dir and its content to be deleted on exit. Am I wrong?

jeremiehuchet avatar Dec 20 '17 11:12 jeremiehuchet

Tip How to use your custom version of PostgreSQL acts as a workaround.

jeremiehuchet avatar Dec 22 '17 13:12 jeremiehuchet

Hi @jeremiehuchet . Looks like it is a bug in EmbeddedPostgres class, which is removing data only. Another issue is that by default it uses CachedPostgresArtifactStore which does not remove artifacts intentionally (to optimize the extracted artifacts usage).

I'll think about the proper way of solving this issue. You can now remove the directory manually as a workaround.

smecsia avatar Jan 03 '18 04:01 smecsia