Skip to content

Commit 0142261

Browse files
committed
make unpackrStream not shared
It causes multiple instances of bunvim to share the unpackrStream, which means that all attached handlers get triggered!
1 parent ec36df3 commit 0142261

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/attach.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
} from "./types.ts";
1616

1717
const packr = new Packr({ useRecords: false });
18-
const unpackrStream = new UnpackrStream({ useRecords: false });
1918

2019
[0, 1, 2].forEach((type) => {
2120
// https://neovim.io/doc/user/api.html#api-definitions
@@ -42,6 +41,7 @@ export async function attach<ApiInfo extends BaseEvents = BaseEvents>({
4241
let lastReqId = 0;
4342
let handlerId = 0;
4443

44+
const unpackrStream = new UnpackrStream({ useRecords: false });
4545
const nvimSocket = await new Promise<net.Socket>((resolve, reject) => {
4646
const client = new net.Socket();
4747
client.once("error", reject);
@@ -199,6 +199,7 @@ export async function attach<ApiInfo extends BaseEvents = BaseEvents>({
199199
},
200200
detach() {
201201
nvimSocket.destroy();
202+
unpackrStream.end();
202203
},
203204
};
204205
}

0 commit comments

Comments
 (0)