Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a crash no longer hangs the server on the idle browser channel #16626

ClosedGodatplay(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/16626/headopened View on GitHub

Showing 2 changed files with 65 additions and 1 deletion.

x
0 of 2 viewed, 2 left
48 additions and 0 deletionsapps/server/src/preview/DesktopBrowserChannel.test.tsModified
View file
@@ -1,4 +1,5 @@
// @effect-diagnostics nodeBuiltinImport:off - The channel reads real file descriptors.
+import * as NodeChildProcess from "node:child_process";
import * as NodeFS from "node:fs";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";
@@ -56,3 +57,50 @@
}).pipe(Effect.scoped),
);
});
+​
+const channelUrl = new URL("./DesktopBrowserChannel.ts", import.meta.url);
+​
+it("lets the server exit after a crash while the desktop holds the channel open", async () => {
+ // fd 3 is the desktop's event pipe and fd 4 its command pipe, both held open and idle
+ // the way the desktop app keeps them between browser events.
+ const child = NodeChildProcess.spawn(
+ process.execPath,
+ [
+ "--input-type=module",
+ "--eval",
+ `import * as NodeServices from "@effect/platform-node/NodeServices";
+import * as Context from "effect/Context";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+const url = ${JSON.stringify(channelUrl.href)};
+const Channel = await import(url);
+const Config = await import(new URL("../config.ts", url));
+await Effect.runPromise(Effect.scoped(Effect.gen(function* () {