File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,9 +231,17 @@ mkdir -p "$bin_dir"
231231if [ -e " ${bin_dir} /t3" ] || [ -L " ${bin_dir} /t3" ]; then
232232 existing=" $( readlink " ${bin_dir} /t3" 2> /dev/null || true) "
233233 real_versions_dir=" $( CDPATH=' ' cd -P -- " $versions_dir " && pwd) "
234+ # Through a symlinked T3 home the link text names the alias; resolve its folder to compare.
235+ existing_dir=" $( CDPATH=' ' cd -P -- " $( dirname -- " ${existing:- .} " ) " 2> /dev/null && pwd || true) "
236+ resolved=" ${existing_dir} /${existing##*/ } "
234237 case " $existing " in
235238 " $versions_dir " /* | " $real_versions_dir " /* | " ${t3_home} /bin/t3" ) ;;
236- * ) fail " another t3 is already at ${bin_dir} /t3. Remove it and run this again, or run ${target_dir} /t3 directly." ;;
239+ * )
240+ case " $resolved " in
241+ " $real_versions_dir " /* ) ;;
242+ * ) fail " another t3 is already at ${bin_dir} /t3. Remove it and run this again, or run ${target_dir} /t3 directly." ;;
243+ esac
244+ ;;
237245 esac
238246fi
239247ln -sfn " ${target_dir} /t3" " ${bin_dir} /t3"
@@ -252,7 +260,8 @@ case "$bin_dir" in "$HOME"/*) path_rest="${bin_dir#"$HOME"}" path_prefix='$HOME'
252260case " $path_rest " in * [!A-Za-z0-9_./-]* ) path_rest= ;; esac
253261if [ -n " $path_rest " ]; then
254262 path_line=" export PATH=\" ${path_prefix}${path_rest} :\$ PATH\" "
255- case " ${SHELL##*/ } " in
263+ shell_name=" ${SHELL:- } "
264+ case " ${shell_name##*/ } " in
256265 zsh) path_command=" printf '\\ n%s\\ n' '${path_line} ' >> ~/.zshrc" ;;
257266 bash) [ " $platform " = darwin ] || path_command=" printf '\\ n%s\\ n' '${path_line} ' >> ~/.bashrc" ;;
258267 fish) path_command=" fish_add_path ${path_prefix}${path_rest} " ;;
Original file line number Diff line number Diff line change @@ -142,6 +142,16 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("install.sh t3
142142 `printf '\\n%s\\n' 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc` ,
143143 ) ;
144144
145+ // Containers and CI often have no SHELL; `set -u` must not stop the installer there.
146+ const noShell = await installOver ( {
147+ script : "install.sh" ,
148+ home,
149+ binDir,
150+ env : { HOME : root , SHELL : undefined , PATH : "/usr/bin:/bin" } ,
151+ } ) ;
152+ expect ( noShell . code , noShell . output ) . toBe ( 0 ) ;
153+ expect ( noShell . output ) . toContain ( `Add ${ binDir } to your PATH` ) ;
154+
145155 await NodeFSP . rm ( link ) ;
146156 await NodeFSP . symlink ( NodePath . join ( home , "bin/t3" ) , link ) ;
147157 const overDesktop = await installOver ( { script : "install.sh" , home, binDir } ) ;
You can’t perform that action at this time.
0 commit comments