fix(cli): report the installed version, not the current directory's

`ludic version` looked for bin/ludicc and VERSION relative to the working
directory. In the toolchain repo that is right by accident; from a project — the
only place a user runs it — there is no ./bin, so a perfectly good install
answered "(version unknown)". It now resolves the compiler through
ludic_home(), like every other command.

The regression test asked for the version from the repo root, so it passed for
the same accidental reason the bug hid behind; it now asks from the staged
project, where the answer can only come from the install.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-05 22:16:16 +03:00
parent 2caf74946f
commit 29fcef3b9c
3 changed files with 22 additions and 5 deletions

View file

@ -84,7 +84,10 @@ function install_layout_case() -> void {
if not shq(`cd {work}/demo && {envp} ludic test > {work}/test.out 2>&1`) {
bad2(lbl, capture_line(`tail -1 {work}/test.out`)); return
}
let ver = capture_line(`{envp} ludic version`)
# from the project directory, never the repo root: `ludic version` used to
# answer from a ./bin and ./VERSION next to the *current* directory, which made
# this check pass in the repo while a real install said "(version unknown)".
let ver = capture_line(`cd {work}/demo && {envp} ludic version`)
if ver != `ludic {s_trim(read_file("VERSION"))}` {
bad2("an installed `ludic version` reports the install's VERSION", `got [{ver}]`); return
}