Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): read desktop telemetry without blocking process exit #14776

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

Showing 2 changed files with 147 additions and 5 deletions.

x
0 of 2 viewed, 2 left
129 additions and 0 deletionsapps/server/src/resourceTelemetry/DesktopTelemetryReceiver.test.tsModified
View file
@@ -1,5 +1,6 @@
// @effect-diagnostics nodeBuiltinImport:off
import * as NodeFS from "node:fs";
+import * as NodeChildProcess from "node:child_process";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";
​
@@ -21,6 +22,134 @@
writeAllToFileDescriptor,
} from "./DesktopTelemetryReceiver.ts";
​
+const receiverUrl = new URL("./DesktopTelemetryReceiver.ts", import.meta.url);
+​
+function runReceiverChild(mode: "crash" | "destroy" | "eof", fileFd?: number) {
+ return new Promise<{
+ output: string;
+ error: string;
+ code: number | null;
+ signal: NodeJS.Signals | null;
+ }>((resolve, reject) => {
+ const child = NodeChildProcess.spawn(
+ process.execPath,
+ [
+ "--input-type=module",
+ "-e",
+ `
+ 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";