From 2d44a3282a39dbde958e3a176a8f4f61b71c4628 Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 25 Sep 2024 11:17:36 +0100 Subject: [PATCH] Call _pg_shutdown on PGlite.close() --- packages/pglite/src/pglite.ts | 1 + packages/pglite/src/postgresMod.ts | 1 + 2 files changed, 2 insertions(+) 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