Unified · Split
| @@ -8,7 +8,6 @@ import * as TestClock from "effect/testing/TestClock"; · 7 unmodified lines | ||
| 8 | 8 | import { describe, expect, it, vi } from "vite-plus/test"; |
| 9 | 9 | |
| 10 | 10 | import { |
| 11 | − extractPathFromShellOutput, | |
| 12 | 11 | CommandAvailability, |
| 13 | 12 | CommandResolutionCache, |
| 14 | 13 | type CommandAvailabilityChecker, |
| @@ -39,28 +38,6 @@ const withWindowsEnvironmentMocks = <A, E, R>( · 24 unmodified lines | ||
| 39 | 38 | Effect.provideService(CommandAvailability, commandAvailable), |
| 40 | 39 | ); |
| 41 | 40 | |
| 42 | −describe("extractPathFromShellOutput", () => { | |
| 43 | − it("extracts the path between capture markers", () => { | |
| 44 | − expect( | |
| 45 | − extractPathFromShellOutput( | |
| 46 | − "__T3CODE_PATH_START__\n/opt/homebrew/bin:/usr/bin\n__T3CODE_PATH_END__\n", | |
| 47 | − ), | |
| 48 | − ).toBe("/opt/homebrew/bin:/usr/bin"); | |
| 49 | − }); | |
| 50 | − | |
| 51 | − it("ignores shell startup noise around the capture markers", () => { | |
| 52 | − expect( | |
| 53 | − extractPathFromShellOutput( | |
| 54 | − "Welcome to fish\n__T3CODE_PATH_START__\n/opt/homebrew/bin:/usr/bin\n__T3CODE_PATH_END__\nBye\n", | |
| 55 | − ), | |
| 56 | − ).toBe("/opt/homebrew/bin:/usr/bin"); | |
| 57 | − }); | |
| 58 | − | |
| 59 | − it("returns null when the markers are missing", () => { | |
| 60 | − expect(extractPathFromShellOutput("/opt/homebrew/bin /usr/bin")).toBeNull(); | |
| 61 | − }); | |
| 62 | −}); | |
| 63 | − | |
| 64 | 41 | describe("readPathFromLoginShell", () => { |
| 65 | 42 | it("uses a shell-agnostic printenv PATH probe", () => { |
| 66 | 43 | const execFile = vi.fn< |
| @@ -12,8 +12,6 @@ import * as Path from "effect/Path"; · 11 unmodified lines | ||
| 12 | 12 | import { HostProcessEnvironment, HostProcessPlatform } from "./hostProcess.ts"; |
| 13 | 13 | import * as Context from "effect/Context"; |
| 14 | 14 | |
| 15 | −const PATH_CAPTURE_START = "__T3CODE_PATH_START__"; | |
| 16 | −const PATH_CAPTURE_END = "__T3CODE_PATH_END__"; | |
| 17 | 15 | const SHELL_ENV_NAME_PATTERN = /^[A-Z0-9_]+$/; |
| 18 | 16 | const WINDOWS_PATH_DELIMITER = ";"; |
| 19 | 17 | const POSIX_PATH_DELIMITER = ":"; |
| @@ -179,18 +177,6 @@ export function listLoginShellCandidates( · 159 unmodified lines | ||
| 179 | 177 | return candidates; |
| 180 | 178 | } |
| 181 | 179 | |
| 182 | −export function extractPathFromShellOutput(output: string): string | null { | |
| 183 | − const startIndex = output.indexOf(PATH_CAPTURE_START); | |
| 184 | − if (startIndex === -1) return null; | |
| 185 | − | |
| 186 | − const valueStartIndex = startIndex + PATH_CAPTURE_START.length; | |
| 187 | − const endIndex = output.indexOf(PATH_CAPTURE_END, valueStartIndex); | |
| 188 | − if (endIndex === -1) return null; | |
| 189 | − | |
| 190 | − const pathValue = output.slice(valueStartIndex, endIndex).trim(); | |
| 191 | − return pathValue.length > 0 ? pathValue : null; | |
| 192 | −} | |
| 193 | − | |
| 194 | 180 | export function readPathFromLoginShell( |
| 195 | 181 | shell: string, |
| 196 | 182 | execFile: ExecFileSyncLike = NodeChildProcess.execFileSync, |