Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): speed up Windows diagnostics and editor discovery #3911

ClosedSivanTechDev(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/3911/headopened View on GitHub

Showing 6 changed files with 53 additions and 18 deletions (loading 3).

x
0 of 6 viewed, 6 left
38 additions and 0 deletionsapps/server/src/diagnostics/ProcessDiagnostics.test.tsModified
View file
@@ -220,6 +220,44 @@
}),
​
+ it.effect("queries each Windows CIM class once", () =>
+ Effect.gen(function* () {
+ const commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }> =
+ [];
+ const spawnerLayer = Layer.succeed(
+ ChildProcessSpawner.ChildProcessSpawner,
+ ChildProcessSpawner.make((command) => {
+ const childProcess = command as unknown as {
+ readonly command: string;
+ readonly args: ReadonlyArray<string>;
+ };
+ commands.push({ command: childProcess.command, args: childProcess.args });
+ return Effect.succeed(mockHandle({ stdout: "[]" }));
+ }),
+ );
+​
+ yield* ProcessDiagnostics.readProcessRows.pipe(
+ Effect.provide(spawnerLayer),
+ Effect.provideService(HostProcessPlatform, "win32"),
+ );
+​
+ expect(commands).toHaveLength(1);
+ const [command] = commands;
+ expect(command?.command).toBe("powershell.exe");
+ expect(command?.args.slice(0, 3)).toEqual(["-NoProfile", "-NonInteractive", "-Command"]);
+ const script = command?.args[3] ?? "";