Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(shared): return the on-disk casing of Windows executables found by case folding #48278

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

Showing 2 changed files with 79 additions and 15 deletions.

x
0 of 2 viewed, 2 left
19 additions and 0 deletionspackages/shared/src/shell.test.tsModified
View file
@@ -745,6 +745,25 @@
}),
​
+ it.effect("returns the listed casing of a Windows executable found by case folding", () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const cwd = yield* fs.makeTempDirectoryScoped({ prefix: "t3-listed-casing-" });
+ const executable = path.join(cwd, "audit-command.cmd");
+ yield* fs.writeFileString(executable, "@echo off\n");
+​
+ const resolved = yield* resolveCommandPath("audit-command", {
+ env: { PATH: cwd, PATHEXT: ".CMD" },
+ }).pipe(
+ Effect.provideService(HostProcess.Platform, "win32"),
+ Effect.provideService(CommandResolutionCache, new Map()),
+ Effect.provideServiceEffect(PathDirectoryListings, makePathDirectoryListings),
+ );
+ expect(resolved).toBe(executable);
+ }),
+ );
+​
// Seconds; the tests below run their clock a minute later, past the window in which a listing is not kept.
const AGED_MTIME = 4_102_444_800;
const afterAgedMtime = TestClock.setTime((AGED_MTIME + 60) * 1000);
60 additions and 15 deletionspackages/shared/src/shell.tsModified
View file