Skip to content

Commit 664a06e

Browse files
committed
wasm: fix crash when disposing crashed process
If the wasm process crashes during Process#createDocumentForVSCodeAsync, then DocumentLinter#disposeAsync is called, DocumentLinter#disposeAsync throws. This is undesired; disposing shouldn't throw. Fix DocumentLinter#disposeAsync to not throw if the wasm process crashes.
1 parent b204808 commit 664a06e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

wasm/quick-lint-js.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ class DocumentLinter {
9999
try {
100100
await this._parserPromise;
101101
} catch (e) {
102-
if (!(e instanceof DocumentLinterDisposed)) {
102+
if (e instanceof DocumentLinterDisposed) {
103+
// Ignore.
104+
} else if (e instanceof ProcessCrashed) {
105+
// Ignore.
106+
} else {
103107
throw e;
104108
}
105109
}

wasm/test-document.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,8 @@ describe("DocumentLinter", () => {
355355
]);
356356
}
357357
} finally {
358-
// TODO(strager): disposeAsync sometimes crashes. Fix the crashes.
359-
if (false) {
360-
if (linter !== null) {
361-
await linter.disposeAsync();
362-
}
358+
if (linter !== null) {
359+
await linter.disposeAsync();
363360
}
364361
}
365362

0 commit comments

Comments
 (0)