Open History to see the last commit
1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { expect, it } from "@effect/vitest";
3import * as HostProcess from "@t3tools/shared/HostProcess";
4import * as Effect from "effect/Effect";
5import * as FileSystem from "effect/FileSystem";
6import * as Option from "effect/Option";
7import * as Path from "effect/Path";
8import * as Sink from "effect/Sink";
9import * as Stream from "effect/Stream";
10import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
11
12import * as DesktopCliCommand from "./DesktopCliCommand.ts";
13import * as DesktopCliShim from "./DesktopCliShim.ts";
14import * as DesktopEnvironment from "./DesktopEnvironment.ts";
15
16const environmentFor = (
17 path: Path.Path,
18 input: { home: string; baseDir: string; platform?: NodeJS.Platform; isPackaged?: boolean },
19) =>
20 DesktopEnvironment.DesktopEnvironment.of({
21 path,
22 platform: input.platform ?? "linux",
23 isPackaged: input.isPackaged ?? true,
24 homeDirectory: input.home,
25 baseDir: input.baseDir,
26 stateDir: path.join(input.baseDir, "userdata"),
27 desktopSettingsPath: path.join(input.baseDir, "userdata", "desktop-settings.json"),
28 serverRoot: "/opt/T3 Code/resources/app.asar",
29 appImagePath: Option.none(),
30 } as unknown as DesktopEnvironment.DesktopEnvironment["Service"]);
31
32const commandIn = (
33 input: {
34 home: string;
35 baseDir?: string;
36 platform?: NodeJS.Platform;
37 isPackaged?: boolean;
38 env?: NodeJS.ProcessEnv;
39 },
40 spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"],
41) =>
42 Effect.gen(function* () {
43 const path = yield* Path.Path;
44 const fs = yield* FileSystem.FileSystem;
45 const baseDir = input.baseDir ?? path.join(input.home, ".t3");
46 yield* fs.makeDirectory(path.join(baseDir, "userdata"), { recursive: true });
47 const make = DesktopCliCommand.make.pipe(
48 Effect.provideService(
49 DesktopEnvironment.DesktopEnvironment,
50 environmentFor(path, { ...input, baseDir }),
51 ),
52 Effect.provideService(HostProcess.Environment, input.env ?? { PATH: "", SHELL: "/bin/zsh" }),
53 );
54 return yield* spawner
55 ? make.pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner))
56 : make;
57 });
58
59/** `inherited` stands in for the app's own environment, which `extendEnv` passes on. */
60const fakePowerShell = (initial: string, inherited: Record<string, string> = {}) => {
61 const registry = {
62 path: initial,
63 failReads: false,
64 failAfterWrite: false,
65 failWrites: false,
66 writes: 0,
67 };
68 const spawner = ChildProcessSpawner.make((command) =>
69 Effect.sync(() => {
70 const { options } = command as unknown as {
71 readonly options: { readonly env?: Record<string, string>; readonly extendEnv?: boolean };
72 };
73 const env = { ...(options.extendEnv ? inherited : {}), ...options.env };
74 let exitCode = 0;
75 let stdout = "";
76 if (env.T3_SET === "1" && registry.failWrites) {
77 exitCode = 1;
78 registry.failReads = true;
79 } else if (env.T3_SET === "1") {
80 registry.path = env.T3_PATH ?? "";
81 registry.writes += 1;
82 if (registry.failAfterWrite) exitCode = 1;
83 } else if (registry.failReads) {
84 exitCode = 1;
85 } else {
86 stdout = Buffer.from(registry.path, "utf8").toString("base64");
87 }
88 return ChildProcessSpawner.makeHandle({
89 pid: ChildProcessSpawner.ProcessId(1),
90 exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(exitCode)),
91 exitStatus: Effect.succeed({
92 _tag: "Exited",
93 code: ChildProcessSpawner.ExitCode(exitCode),
94 }),
95 isRunning: Effect.succeed(false),
96 kill: () => Effect.void,
97 unref: Effect.succeed(Effect.void),
98 stdin: Sink.drain,
99 stdout: Stream.make(new TextEncoder().encode(stdout)),
100 stderr: Stream.empty,
101 all: Stream.empty,
102 getInputFd: () => Sink.drain,
103 getOutputFd: () => Stream.empty,
104 });
105 }),
106 );
107 return { registry, spawner };
108};
109
110it.layer(NodeServices.layer)("DesktopCliCommand", (it) => {
111 it.effect("links the launcher onto PATH and removes only that link", () =>
112 Effect.gen(function* () {
113 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
114 const fs = yield* FileSystem.FileSystem;
115 const path = yield* Path.Path;
116 const home = yield* fs.makeTempDirectoryScoped();
117 const command = yield* commandIn({ home, env });
118 const link = path.join(home, ".local", "bin", "t3");
119
120 expect(yield* command.state).toEqual({
121 supported: true,
122 installedPath: null,
123 onPath: false,
124 launcherPath: null,
125 });
126 yield* command.installOnFirstLaunch;
127 expect((yield* command.state).installedPath).toBe(link);
128 const installed = yield* command.install;
129 expect(installed.installedPath).toBe(link);
130 expect(installed.launcherPath).toBe(path.join(home, ".t3", "bin", "t3"));
131 expect(installed.pathSetup).toEqual({ file: "~/.zshrc", added: false });
132 expect(yield* fs.readLink(link)).toBe(path.join(home, ".t3", "bin", "t3"));
133 expect((yield* command.install).installedPath).toBe(link);
134
135 // Add to PATH appends one line, once, and keeps a final line with no newline intact.
136 const zshrc = path.join(home, ".zshrc");
137 yield* fs.writeFileString(zshrc, "# mine");
138 // A folder already on PATH needs nothing.
139 env.PATH = path.join(home, ".local", "bin");
140 yield* command.addToPath;
141 expect(yield* fs.readFileString(zshrc)).toBe("# mine");
142 env.PATH = "";
143 yield* Effect.all([command.addToPath, command.addToPath], { concurrency: "unbounded" });
144 expect((yield* command.addToPath).pathSetup).toEqual({ file: "~/.zshrc", added: true });
145 expect(yield* fs.readFileString(zshrc)).toBe(
146 '# mine\n# Added by T3 Code\nexport PATH="$PATH:$HOME/.local/bin"\n',
147 );
148
149 expect((yield* command.uninstall).installedPath).toBeNull();
150 expect(yield* fs.exists(link)).toBe(false);
151 expect(yield* fs.exists(path.join(home, ".t3", "bin", "t3"))).toBe(true);
152 // Removed stays removed: first launch never installs again.
153 yield* command.installOnFirstLaunch;
154 expect(yield* fs.exists(link)).toBe(false);
155
156 // Also when first launch was put off (no shell PATH yet) and the user removed it meanwhile.
157 const laterHome = yield* fs.makeTempDirectoryScoped();
158 const later = yield* commandIn({ home: laterHome, env });
159 yield* later.install;
160 yield* later.uninstall;
161 yield* later.installOnFirstLaunch;
162 expect(yield* fs.exists(path.join(laterHome, ".local", "bin", "t3"))).toBe(false);
163
164 // An app that ran before left its settings or launcher. Its user may have removed t3 or
165 // chosen another, so first launch leaves it to Settings, where Install still works.
166 for (const left of ["userdata/desktop-settings.json", "bin/t3"]) {
167 const upgradedHome = yield* fs.makeTempDirectoryScoped();
168 const leftFile = path.join(upgradedHome, ".t3", left);
169 yield* fs.makeDirectory(path.dirname(leftFile), { recursive: true });
170 yield* fs.writeFileString(leftFile, `#!/bin/sh\n# ${DesktopCliShim.MARKER}\n`);
171 const upgraded = yield* commandIn({ home: upgradedHome, env });
172 yield* upgraded.installOnFirstLaunch;
173 const upgradedLink = path.join(upgradedHome, ".local", "bin", "t3");
174 expect(yield* fs.exists(upgradedLink)).toBe(false);
175 expect((yield* upgraded.install).installedPath).toBe(upgradedLink);
176 }
177 }),
178 );
179
180 it.effect("never replaces or removes a t3 it did not create", () =>
181 Effect.gen(function* () {
182 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
183 const fs = yield* FileSystem.FileSystem;
184 const path = yield* Path.Path;
185 const home = yield* fs.makeTempDirectoryScoped();
186 const command = yield* commandIn({ home, env });
187 const theirs = path.join(home, ".local", "bin", "t3");
188 yield* fs.makeDirectory(path.dirname(theirs), { recursive: true });
189 yield* fs.writeFileString(theirs, "npm's t3\n");
190 yield* fs.makeDirectory(path.join(home, "bin"), { recursive: true });
191 yield* fs.symlink(path.join(home, "gone"), path.join(home, "bin", "t3"));
192
193 const error = yield* Effect.flip(command.install);
194 expect(error.message).toContain("Another t3 command is already in");
195 yield* command.uninstall;
196 expect(yield* fs.readFileString(theirs)).toBe("npm's t3\n");
197 expect(yield* fs.readLink(path.join(home, "bin", "t3"))).toBe(path.join(home, "gone"));
198
199 // A fresh install beside someone else's t3 (even off PATH or a dangling link) adds no second
200 // t3 in ~/bin.
201 for (const dangling of [false, true]) {
202 const besideHome = yield* fs.makeTempDirectoryScoped();
203 const other = path.join(besideHome, ".local", "bin", "t3");
204 yield* fs.makeDirectory(path.dirname(other), { recursive: true });
205 yield* dangling
206 ? fs.symlink(path.join(besideHome, "gone"), other)
207 : fs.writeFileString(other, "npm's t3\n");
208 yield* (yield* commandIn({ home: besideHome })).installOnFirstLaunch;
209 expect(yield* fs.exists(path.join(besideHome, "bin", "t3"))).toBe(false);
210 }
211
212 const launcher = path.join(home, ".t3", "bin", "t3");
213 yield* fs.writeFileString(launcher, "npm's t3\n");
214 env.PATH = path.dirname(launcher);
215 expect(yield* command.state).toMatchObject({ onPath: false, shadowedBy: launcher });
216 expect((yield* Effect.flip(command.install)).message).toContain("Could not set up");
217 yield* command.uninstall;
218 expect(yield* fs.readFileString(launcher)).toBe("npm's t3\n");
219 }),
220 );
221
222 it.effect("finds and removes a link left by a previous T3 home", () =>
223 Effect.gen(function* () {
224 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
225 const fs = yield* FileSystem.FileSystem;
226 const path = yield* Path.Path;
227 const home = yield* fs.makeTempDirectoryScoped();
228 const before = yield* commandIn({ home, baseDir: path.join(home, "old-t3"), env });
229 const link = (yield* before.install).installedPath;
230
231 const after = yield* commandIn({ home, baseDir: path.join(home, "new-t3"), env });
232 // A first launch leaves another home's command alone; only Install takes it over.
233 yield* after.installOnFirstLaunch;
234 expect(yield* fs.readLink(link!)).toBe(path.join(home, "old-t3", "bin", "t3"));
235 // On PATH, it runs the other home's launcher. Settings offers Install (not Remove, and not
236 // "another t3 runs first"), which updates that link in place.
237 env.PATH = path.dirname(link!);
238 expect(yield* after.state).toMatchObject({ installedPath: null, onPath: false });
239 expect((yield* after.state).shadowedBy).toBeUndefined();
240 env.PATH = "";
241 // Off PATH, Add to PATH would expose the other home's command, not this one.
242 expect((yield* after.state).pathSetup).toBeUndefined();
243 yield* Effect.flip(after.addToPath);
244 expect(yield* fs.exists(path.join(home, ".zshrc"))).toBe(false);
245 // Behind another t3 the install fails, and the old link still works.
246 const shadow = path.join(home, "shadow");
247 yield* fs.makeDirectory(shadow);
248 yield* fs.writeFileString(path.join(shadow, "t3"), "#!/bin/sh\n", { mode: 0o755 });
249 env.PATH = shadow;
250 yield* Effect.flip(after.install);
251 expect(yield* fs.readLink(link!)).toBe(path.join(home, "old-t3", "bin", "t3"));
252 // Install takes it over, also with its folder first on PATH.
253 env.PATH = path.dirname(link!);
254 expect((yield* after.install).installedPath).toBe(link);
255 expect(yield* fs.readLink(link!)).toBe(path.join(home, "new-t3", "bin", "t3"));
256 env.PATH = "";
257 yield* after.uninstall;
258 expect(yield* fs.exists(path.join(home, ".local", "bin", "t3"))).toBe(false);
259 expect(yield* fs.exists(path.join(home, "bin", "t3"))).toBe(false);
260
261 // A folder already on PATH wins, even written with a trailing slash.
262 env.PATH = `${path.join(home, "bin")}/`;
263 expect((yield* after.install).installedPath).toBe(path.join(home, "bin", "t3"));
264
265 // An old link of ours is updated where it is, not moved to a folder that may be off PATH.
266 yield* fs.writeFileString(path.join(home, "bin", "t3.staging"), "mine");
267 yield* fs.remove(path.join(home, "bin", "t3"));
268 yield* fs.symlink(path.join(home, "old-t3", "bin", "t3"), path.join(home, "bin", "t3"));
269 env.PATH = "";
270 expect((yield* after.install).installedPath).toBe(path.join(home, "bin", "t3"));
271 expect(yield* fs.readLink(path.join(home, "bin", "t3"))).toBe(
272 path.join(home, "new-t3", "bin", "t3"),
273 );
274 expect(yield* fs.exists(path.join(home, ".local", "bin", "t3"))).toBe(false);
275 expect(yield* fs.readFileString(path.join(home, "bin", "t3.staging"))).toBe("mine");
276 }),
277 );
278
279 it.effect("refuses to install behind another t3 that runs first", () =>
280 Effect.gen(function* () {
281 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
282 const fs = yield* FileSystem.FileSystem;
283 const path = yield* Path.Path;
284 const home = yield* fs.makeTempDirectoryScoped();
285 const shadow = path.join(home, "shadow");
286 yield* fs.makeDirectory(shadow);
287 yield* fs.writeFileString(path.join(shadow, "t3"), "#!/bin/sh\n", { mode: 0o755 });
288 env.PATH = [shadow, `${path.join(home, ".local", "bin")}/`].join(":");
289
290 const command = yield* commandIn({ home, env });
291 const theirs = path.join(shadow, "t3");
292 expect((yield* command.state).shadowedBy).toBe(theirs);
293 const error = yield* Effect.flip(command.install);
294 expect(error.message).toContain(theirs);
295 yield* command.installOnFirstLaunch;
296 expect(yield* fs.exists(path.join(home, ".local", "bin", "t3"))).toBe(false);
297 expect(yield* fs.readFileString(theirs)).toBe("#!/bin/sh\n");
298
299 // Its folder is already on PATH behind theirs; adding it again would change which t3 runs.
300 yield* fs.makeDirectory(path.join(home, ".local", "bin"), { recursive: true });
301 yield* fs.symlink(
302 path.join(home, ".t3", "bin", "t3"),
303 path.join(home, ".local", "bin", "t3"),
304 );
305 const behind = yield* command.state;
306 expect(behind.installedPath).toBe(path.join(home, ".local", "bin", "t3"));
307 expect(behind.pathSetup).toBeUndefined();
308 // Off PATH behind theirs, adding the folder would still put ours first.
309 env.PATH = shadow;
310 expect((yield* command.state).pathSetup).toBeUndefined();
311 yield* Effect.flip(command.addToPath);
312 expect(yield* fs.exists(path.join(home, ".zshrc"))).toBe(false);
313 env.PATH = [shadow, `${path.join(home, ".local", "bin")}/`].join(":");
314 yield* fs.remove(path.join(home, ".local", "bin", "t3"));
315
316 // A first-launch install that failed is not retried behind the user's back.
317 yield* fs.remove(theirs);
318 yield* command.installOnFirstLaunch;
319 expect(yield* fs.exists(path.join(home, ".local", "bin", "t3"))).toBe(false);
320 const installed = yield* command.install;
321 expect(installed).toMatchObject({
322 onPath: true,
323 installedPath: path.join(home, ".local", "bin", "t3"),
324 });
325 expect(installed.shadowedBy).toBeUndefined();
326 }),
327 );
328
329 it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
330 "skips a t3 directory or a file this user cannot execute",
331 () =>
332 Effect.gen(function* () {
333 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
334 const fs = yield* FileSystem.FileSystem;
335 const path = yield* Path.Path;
336 const home = yield* fs.makeTempDirectoryScoped();
337 const folder = path.join(home, "folder");
338 const plain = path.join(home, "plain");
339 const shadow = path.join(home, "shadow");
340 yield* fs.makeDirectory(path.join(folder, "t3"), { recursive: true });
341 yield* fs.makeDirectory(plain);
342 yield* fs.writeFileString(path.join(plain, "t3"), "notes\n");
343 // Root can execute mode 0o601; other users must honor the owner permissions.
344 yield* fs.chmod(path.join(plain, "t3"), process.getuid?.() === 0 ? 0o600 : 0o601);
345 yield* fs.makeDirectory(shadow);
346 yield* fs.writeFileString(path.join(shadow, "t3"), "#!/bin/sh\n", { mode: 0o755 });
347 env.PATH = [folder, plain, shadow, path.join(home, ".local", "bin")].join(":");
348
349 const command = yield* commandIn({ home, env });
350 expect((yield* command.state).shadowedBy).toBe(path.join(shadow, "t3"));
351
352 const error = yield* Effect.flip(command.install);
353 expect(error.message).toContain(path.join(shadow, "t3"));
354
355 yield* fs.remove(shadow, { recursive: true });
356 expect(yield* command.install).toMatchObject({
357 onPath: true,
358 installedPath: path.join(home, ".local", "bin", "t3"),
359 });
360 }),
361 );
362
363 it.effect("does not treat its own launcher as another t3 when its folder is first on PATH", () =>
364 Effect.gen(function* () {
365 const env: NodeJS.ProcessEnv = { PATH: "", SHELL: "/bin/zsh" };
366 const fs = yield* FileSystem.FileSystem;
367 const path = yield* Path.Path;
368 const home = yield* fs.makeTempDirectoryScoped();
369 const launcher = path.join(home, ".t3", "bin", "t3");
370 env.PATH = [path.dirname(launcher), path.join(home, ".local", "bin")].join(":");
371
372 const command = yield* commandIn({ home, env });
373 const installed = yield* command.install;
374
375 expect(yield* fs.exists(launcher)).toBe(true);
376 expect(installed).toMatchObject({
377 onPath: true,
378 installedPath: path.join(home, ".local", "bin", "t3"),
379 });
380 expect(installed.shadowedBy).toBeUndefined();
381 expect(yield* command.state).toEqual(installed);
382
383 const removed = yield* command.uninstall;
384 expect(removed.installedPath).toBeNull();
385 expect(removed.onPath).toBe(true);
386 expect(yield* command.state).toEqual(removed);
387 expect(yield* fs.exists(installed.installedPath!)).toBe(false);
388 expect(yield* fs.exists(launcher)).toBe(true);
389 }),
390 );
391
392 it.effect("leaves the Windows PATH alone when it cannot be read", () =>
393 Effect.gen(function* () {
394 const fs = yield* FileSystem.FileSystem;
395 const home = yield* fs.makeTempDirectoryScoped();
396 const userPath = "C:\\Users\\Me\\npm;%USERPROFILE%\\tools";
397 const { registry, spawner } = fakePowerShell(userPath);
398 const command = yield* commandIn({ home, platform: "win32" }, spawner);
399
400 registry.failReads = true;
401 const error = yield* Effect.flip(command.install);
402 expect(error.message).toContain("left unchanged");
403 expect(registry).toMatchObject({ path: userPath, writes: 0 });
404
405 registry.failReads = false;
406 const launcherDir = DesktopCliShim.launcherPath(
407 environmentFor(yield* Path.Path, { home, baseDir: `${home}/.t3`, platform: "win32" }),
408 ).replace(/[\\/]t3\.cmd$/, "");
409 yield* command.install;
410 expect(registry.path).toBe(`${userPath};${launcherDir}`);
411 yield* command.uninstall;
412 expect(registry.path).toBe(userPath);
413
414 // A `;` in the folder would split it into two PATH entries, so nothing is written.
415 const split = fakePowerShell(userPath);
416 const semicolon = yield* commandIn(
417 { home, baseDir: `${home}\\T3;Home`, platform: "win32" },
418 split.spawner,
419 );
420 expect((yield* Effect.flip(semicolon.install)).message).toContain('has a ";"');
421 expect(split.registry).toMatchObject({ path: userPath, writes: 0 });
422
423 // An inherited T3_SET=1 never turns a read into a write of the whole PATH.
424 const inherited = fakePowerShell(userPath, { T3_SET: "1", T3_PATH: "C:\\other" });
425 const reader = yield* commandIn({ home, platform: "win32" }, inherited.spawner);
426 yield* reader.install;
427 expect(inherited.registry).toMatchObject({ path: `${userPath};${launcherDir}`, writes: 1 });
428 }),
429 );
430
431 it.effect("can remove the Windows PATH entry after retrying a partial install", () =>
432 Effect.gen(function* () {
433 const fs = yield* FileSystem.FileSystem;
434 const path = yield* Path.Path;
435 const home = yield* fs.makeTempDirectoryScoped();
436 const baseDir = path.join(home, ".t3");
437 const marker = path.join(baseDir, "userdata", "cli-command-path-entry");
438 const launcher = DesktopCliShim.launcherPath(
439 environmentFor(path, { home, baseDir, platform: "win32" }),
440 );
441 const originalPath = "C:\\Tools";
442 const { registry, spawner } = fakePowerShell(originalPath);
443 const command = yield* commandIn({ home, baseDir, platform: "win32" }, spawner);
444
445 yield* fs.makeDirectory(marker);
446 expect((yield* Effect.flip(command.install)).message).toContain("could not record it");
447 expect(registry.path).toBe(`${originalPath};${path.dirname(launcher)}`);
448 yield* fs.remove(marker);
449
450 const retried = yield* command.install;
451 expect(retried.installedPath).not.toBeNull();
452 yield* command.uninstall;
453 expect(registry.path).toBe(originalPath);
454
455 registry.failAfterWrite = true;
456 expect((yield* Effect.flip(command.install)).message).toContain("Could not update your PATH");
457 expect(registry.path).toBe(`${originalPath};${path.dirname(launcher)}`);
458
459 registry.failAfterWrite = false;
460 expect((yield* command.install).installedPath).not.toBeNull();
461 yield* command.uninstall;
462 expect(registry.path).toBe(originalPath);
463 registry.failWrites = true;
464 yield* Effect.flip(command.install);
465 registry.failReads = false;
466 registry.path = `${originalPath};${path.dirname(launcher)}`;
467 expect((yield* command.install).installedPath).toBeNull();
468 yield* command.uninstall;
469 expect(registry.path).toBe(`${originalPath};${path.dirname(launcher)}`);
470 }),
471 );
472
473 it.effect("does not claim or remove a Windows PATH entry the user added", () =>
474 Effect.gen(function* () {
475 const fs = yield* FileSystem.FileSystem;
476 const path = yield* Path.Path;
477 const home = yield* fs.makeTempDirectoryScoped();
478 const launcherDir = path.dirname(
479 DesktopCliShim.launcherPath(
480 environmentFor(path, { home, baseDir: path.join(home, ".t3"), platform: "win32" }),
481 ),
482 );
483 const userPath = `C:\\Tools;${launcherDir}`;
484 const { registry, spawner } = fakePowerShell(userPath);
485 const command = yield* commandIn({ home, platform: "win32" }, spawner);
486
487 expect((yield* command.state).installedPath).toBeNull();
488 yield* command.uninstall;
489 expect(registry.path).toBe(userPath);
490 // Install leaves the user's entry theirs, so Remove keeps it.
491 expect((yield* command.install).installedPath).toBeNull();
492 yield* command.uninstall;
493 expect(registry).toMatchObject({ path: userPath, writes: 0 });
494
495 // A fresh install beside a standalone t3.cmd (from `t3 install`), even off PATH, leaves
496 // PATH alone.
497 const besideHome = yield* fs.makeTempDirectoryScoped();
498 yield* fs.makeDirectory(path.join(besideHome, ".local", "bin"), { recursive: true });
499 yield* fs.writeFileString(path.join(besideHome, ".local", "bin", "t3.cmd"), "@echo off\r\n");
500 const beside = fakePowerShell("C:\\Tools");
501 yield* (yield* commandIn({ home: besideHome, platform: "win32" }, beside.spawner))
502 .installOnFirstLaunch;
503 expect(beside.registry).toMatchObject({ path: "C:\\Tools", writes: 0 });
504 }),
505 );
506});