Skip to content

Commit

Permalink
Preserve all X_HOME environment variables created by SDKMAN!.
Browse files Browse the repository at this point in the history
Adresses issue #24.
  • Loading branch information
reitzig committed Nov 9, 2018
1 parent 9dd152b commit 85d10ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions conf.d/sdk.fish
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function __fish_sdkman_run_in_bash
bash -c "$argv[1];
echo -e \"\$?\" > $pipe;
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe" # it's not an environment variable!
set bashDump (cat $pipe; rm $pipe)

Expand Down
12 changes: 9 additions & 3 deletions test/wrapper.fish
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ echo "Testing the sdk wrapper"
set failures 0
for sdk_cmd in $test_commands
echo " Testing '$sdk_cmd'"
bash -c "source \"$sdk_init\" && $sdk_cmd > sout_bash; echo \"\$?\" > status_bash; echo "\$PATH" > path_bash"
fish -c "$sdk_cmd > sout_fish; echo \"\$status\" > status_fish; echo "\$PATH" > path_fish"
bash -c "source \"$sdk_init\" && $sdk_cmd > sout_bash;
echo \"\$?\" > status_bash;
echo \"\$PATH\" > path_bash;
echo \"\$ANT_HOME\" > anthome_bash"
fish -c "$sdk_cmd > sout_fish;
echo \"\$status\" > status_fish;
echo \"\$PATH\" > path_fish;
echo \"\$ANT_HOME\" > anthome_fish"

# For nicer diffs: one entry per line, sorted
string split ":" (cat path_bash) | sort > path_bash
string split " " (cat path_fish) | sort > path_fish

for out in sout status path
for out in sout status path anthome
if [ (checksum "$out"_bash) != (checksum "$out"_fish) ]
echo " - $out bad:"
diff "$out"_bash "$out"_fish | sed -e 's/^/ /'
Expand Down

0 comments on commit 85d10ac

Please sign in to comment.