File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -499,8 +499,12 @@ with_plugin_env() {
499499 plugin_path=$( get_plugin_path " $plugin_name " )
500500
501501 # add the plugin listed exec paths to PATH
502- local path
503- path=" $( list_plugin_exec_paths " $plugin_name " " $full_version " | tr ' \n' ' :' ) :$PATH "
502+ local path exec_paths
503+ exec_paths=" $( list_plugin_exec_paths " $plugin_name " " $full_version " ) "
504+
505+ # exec_paths contains a trailing newline which is converted to a colon, so no
506+ # colon is needed between the subshell and the PATH variable in this string
507+ path=" $( echo " $exec_paths " | tr ' \n' ' :' ) $PATH "
504508
505509 # If no custom exec-env transform, just execute callback
506510 if [ ! -f " ${plugin_path} /bin/exec-env" ]; then
Original file line number Diff line number Diff line change @@ -66,3 +66,19 @@ teardown() {
6666 [ " $output " == " $ASDF_DIR /shims/dummy" ]
6767 [ " $status " -eq 0 ]
6868}
69+
70+ @test " asdf env should set PATH correctly" {
71+ echo " dummy 1.0" > $PROJECT_DIR /.tool-versions
72+ run asdf install
73+
74+ run asdf env dummy
75+ [ " $status " -eq 0 ]
76+
77+ # Should set path
78+ path_line=$( echo " $output " | grep ' ^PATH=' )
79+ [ " $path_line " != " " ]
80+
81+ # Should not contain duplicate colon
82+ run grep ' ::' <( echo " $path_line " )
83+ [ " $duplicate_colon " == " " ]
84+ }
You can’t perform that action at this time.
0 commit comments