Files
rea/src/process/CurrentEntrypointPath.ts
T
morluto 19329e43bb fix(setup): preserve launcher identity and uncertainty
Use one registration classifier for doctor, maintenance and uninstall.
Preserve unknown identity when launcher resolution fails, and compare native
paths without collapsing symlink traversal. Keep Node argv script selection
separate; ambiguous direct-launch interpretations cannot authorize removal.
Remove the superseded boolean ownership parser.

Validation: 183 focused tests passed, 2 Windows cases skipped; check:fast
and docs:check passed. Five public regressions fail on the baseline, including
foreign registration removal in an isolated fixture. Source review and authored
Node shebang controls completed on macOS with Node 24.18.0. Native Windows,
Linux and real mise upgrades remain unverified.

Closes #4895
Closes #4896
2026-10-18 06:18:34 +08:00

14 lines
486 B
TypeScript

import { resolve } from "node:path";
/** Node's absolute argv script selection, or undefined when none was supplied.
* Native executable paths have different traversal semantics and must not use this.
*/
export const normalizeEntrypointPath = (
entrypoint: string | undefined,
): string | undefined =>
entrypoint === undefined || entrypoint.length === 0
? undefined
: resolve(entrypoint);
export const CURRENT_ENTRYPOINT_PATH = normalizeEntrypointPath(process.argv[1]);