Skip to content

Commit acf5798

Browse files
jdxclaude
andcommitted
review: rename shadowed closure params and check exit codes in e2e
- runtime_symlinks: rename closure params `from_name`/`to_name` to `f`/`t` so the outer `from_name: String` used by `concrete_installs.contains` is obviously distinct from the closure's `OsStr` args. - test_install_system_readonly: extract `assert_silent_install` helper that fails on a non-zero exit code instead of just inspecting stdout. Catches the case where mise crashes with an unrelated error message. Review feedback from gemini-code-assist and greptile-apps on #9410. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent eb6e707 commit acf5798

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

e2e/cli/test_install_system_readonly

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,27 @@ assert "readlink $SYSTEM_INSTALLS/tiny/latest" "./2.1.0"
2424
chmod -R a-w "$SYSTEM_INSTALLS"
2525
trap 'chmod -R u+w "$SYSTEM_INSTALLS" 2>/dev/null || true' EXIT
2626

27+
assert_silent_install() {
28+
local out
29+
if ! out="$($1 2>&1)"; then
30+
echo "$out"
31+
fail "[$1] command failed"
32+
fi
33+
echo "$out"
34+
if [[ $out == *"skipping symlink update"* || $out == *"Permission denied"* || $out == *"failed rm"* ]]; then
35+
fail "[$1] unexpected system-dir warning during install"
36+
fi
37+
}
38+
2739
# Re-installing a tool that lives only in the user dir must succeed without
2840
# any warning about the system dir — the system-side runtime symlink already
2941
# matches the desired state, so nothing should be written or attempted there.
30-
out="$(mise install --force [email protected] 2>&1)"
31-
echo "$out"
32-
if [[ $out == *"skipping symlink update"* || $out == *"Permission denied"* || $out == *"failed rm"* ]]; then
33-
echo "FAIL: unexpected system-dir warning during install"
34-
exit 1
35-
fi
42+
assert_silent_install "mise install --force [email protected]"
3643
assert "readlink $USER_INSTALLS/tiny/latest" "./1.0.0"
3744
assert "readlink $SYSTEM_INSTALLS/tiny/latest" "./2.1.0"
3845

3946
# Installing a different tool that doesn't touch the system dir at all must
4047
# also succeed silently.
41-
out="$(mise install [email protected] 2>&1)"
42-
echo "$out"
43-
if [[ $out == *"skipping symlink update"* || $out == *"Permission denied"* || $out == *"failed rm"* ]]; then
44-
echo "FAIL: unexpected system-dir warning during install"
45-
exit 1
46-
fi
48+
assert_silent_install "mise install [email protected]"
4749
assert_directory_exists "$USER_INSTALLS/dummy/1.0.0"
4850
assert "readlink $SYSTEM_INSTALLS/tiny/latest" "./2.1.0"

src/runtime_symlinks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn rebuild_symlinks_in_dir(
7272
} else if from
7373
.file_name()
7474
.zip(to.file_name())
75-
.is_some_and(|(from_name, to_name)| from_name != to_name)
75+
.is_some_and(|(f, t)| f != t)
7676
&& !concrete_installs.contains(&from_name)
7777
{
7878
// Real (non-symlink) directory at a runtime-symlink slot —

0 commit comments

Comments
 (0)