diff --git a/packages/pglite/src/pglite.ts b/packages/pglite/src/pglite.ts index 15a91d05..808b98d5 100644 --- a/packages/pglite/src/pglite.ts +++ b/packages/pglite/src/pglite.ts @@ -415,6 +415,7 @@ export class PGlite // Close the database try { await this.execProtocol(serialize.end()) + this.mod!._pg_shutdown() } catch (e) { const err = e as { name: string; status: number } if (err.name === 'ExitStatus' && err.status === 0) { diff --git a/packages/pglite/src/postgresMod.ts b/packages/pglite/src/postgresMod.ts index baf4d1ca..5eb7a1ea 100644 --- a/packages/pglite/src/postgresMod.ts +++ b/packages/pglite/src/postgresMod.ts @@ -24,6 +24,7 @@ export interface PostgresMod INITIAL_MEMORY: number pg_extensions: Record> _pg_initdb: () => number + _pg_shutdown: () => void _interactive_write: (msgLength: number) => void _interactive_one: () => void _interactive_read: () => number