Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk use does not have any effect #8

Closed
rahulsom opened this issue Jul 14, 2018 · 4 comments
Closed

sdk use does not have any effect #8

rahulsom opened this issue Jul 14, 2018 · 4 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@rahulsom
Copy link

This is what I see.

 ~/src  sdk ls java                                                                                                                                                                                                  Fri Jul 13 22:12:14 2018

================================================================================
Available Java Versions
================================================================================
     9.0.7-zulu
   + 9.0.4-oracle
     9.0.4-openjdk
   + 9.0.1-oracle
   + 9.0.0-zulu
 > + 8u141-oracle
   + 8u131
   * 8.0.172-zulu
     8.0.171-oracle
   + 7u79
     7.0.181-zulu
   + 6u65
   * 10.0.1-zulu
     10.0.1-oracle
     10.0.0-openjdk

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
 ~/src  sdk u java 10.0.1-zulu                                                                                                                                                                              1507ms  Fri Jul 13 22:12:19 2018

Using java version 10.0.1-zulu in this shell.
 ~/src  sdk ls java                                                                                                                                                                                         1453ms  Fri Jul 13 22:12:32 2018

================================================================================
Available Java Versions
================================================================================
     9.0.7-zulu
   + 9.0.4-oracle
     9.0.4-openjdk
   + 9.0.1-oracle
   + 9.0.0-zulu
 > + 8u141-oracle
   + 8u131
   * 8.0.172-zulu
     8.0.171-oracle
   + 7u79
     7.0.181-zulu
   + 6u65
   * 10.0.1-zulu
     10.0.1-oracle
     10.0.0-openjdk

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
 ~/src                                                                                                                                                                                                      1463ms  Fri Jul 13 22:12:37 2018
@reitzig
Copy link
Owner

reitzig commented Jul 14, 2018

Since this project ist mostly about completion, I checked that. Seems to work as expected on my end:

image

image

image

As for sdk use not doing what it's supposed to do: can confirm. Works with bash, so it's about the fish wrapper.

Fish calls bash to perform sdk actions; I assume bash changed the version in the current (bash) shell, which then exited. This is a conceptual issue, not a programming bug. Will have to think and tinker; any input appreciated.

FWIW, sdk default works just fine.

@reitzig reitzig added bug Something isn't working help wanted Extra attention is needed labels Jul 14, 2018
@reitzig reitzig changed the title sdk u doesn't work sdk use does not have any effect Jul 14, 2018
reitzig added a commit that referenced this issue Jul 14, 2018
@reitzig
Copy link
Owner

reitzig commented Jul 14, 2018

sdk directly manipulates PATH. Therefore, the solution is to copy PATH from the bash subshell to the current shell.

Thanks for your report!

Tests performed

Straight-forward change

> java -version
java version "10.0.1" 2018-04-17
> sdk u java 8.0.171-oracle 

Using java version 8.0.171-oracle in this shell.
> java -version
java version "1.8.0_171"

Change carries over to subshell

> java -version
java version "10.0.1" 2018-04-17
raphael@donald ~> sdk u java 8.0.171-oracle 

Using java version 8.0.171-oracle in this shell.
> fish
Welcome to fish, the friendly interactive shell
> java -version
java version "1.8.0_171"

Change does not carry over to parent shell

> java -version
java version "10.0.1" 2018-04-17
raphael@donald ~> fish
Welcome to fish, the friendly interactive shell
raphael@donald ~> sdk u java 8.0.171-oracle 

Using java version 8.0.171-oracle in this shell.
raphael@donald ~> java -version
java version "1.8.0_171"
raphael@donald ~> exit
raphael@donald ~> java -version
java version "10.0.1" 2018-04-17

@reitzig reitzig closed this as completed Jul 14, 2018
@reitzig
Copy link
Owner

reitzig commented Jul 14, 2018

Nota bene: fish-sdk now copies PATH always (as long as sdk succeeds). I'm sure issues can be caused by that. I might also have missed some escaping or another so some PATH entries might break the script. Awaiting reports.

@reitzig reitzig self-assigned this Jul 14, 2018
This was referenced Jul 14, 2018
@reitzig
Copy link
Owner

reitzig commented Jul 14, 2018

This could provide an alternative: https://github.com/oh-my-fish/plugin-foreign-env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants