mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Add workaround (#17893)
This commit is contained in:
18
src/js/thirdparty/ws.js
vendored
18
src/js/thirdparty/ws.js
vendored
@@ -266,11 +266,17 @@ class BunWebSocket extends EventEmitter {
|
||||
}
|
||||
|
||||
close(code, reason) {
|
||||
this.#ws.close(code, reason);
|
||||
const ws = this.#ws;
|
||||
if (ws) {
|
||||
ws.close(code, reason);
|
||||
}
|
||||
}
|
||||
|
||||
terminate() {
|
||||
this.#ws.terminate();
|
||||
const ws = this.#ws;
|
||||
if (ws) {
|
||||
ws.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
get url() {
|
||||
@@ -872,6 +878,14 @@ class BunWebSocketMocked extends EventEmitter {
|
||||
}
|
||||
|
||||
terminate() {
|
||||
// Temporary workaround for CTRL + C error appearing in next dev with turobpack
|
||||
//
|
||||
// > ⨯ unhandledRejection: TypeError: undefined is not an object (evaluating 'this.#state')
|
||||
// > at terminate (ws:611:30)
|
||||
// > at Promise (null)
|
||||
//
|
||||
if (!this) return;
|
||||
|
||||
let state = this.#state;
|
||||
if (state === 3) return;
|
||||
if (state === 0) {
|
||||
|
||||
Reference in New Issue
Block a user