Closed reitzig closed 4 years ago
Idea 2: source grep -v 'export' ~/.sdkman/bin/sdkman-init.sh
(roughly speaking, three empty if clauses remain) and hope that nothing breaks.
Huh. sed -e 's/^\(\s*\).*\(export\|to_path\).*$/\1:/g' "$__fish_sdkman_init"
-- or, in clumsy human-speak, remove all lines that write to PATH
-- seems to actually do it.
The current hack is not robust against updates of SDKMAN! (or users editing sdkman-init.sh
): the old edited version will stay around.
Tentatively merging this into master because the risk of the hack is offset by, well, sdk
working at all. Leaving this open in the hope that a better solution arises.
Closing for now: the workaround seems to be effective.
We may need a little more finesse for some corner cases; such will be dealt with in separate issues if and when they arise.
Expected
Actual
Analysis
We delegate command
source $sdkman_init && sdk $argv
to bash. We have to, because otherwise functionsdk
is not defined in that shell.This initialization overwrites the environment variables inherited from the parent fish shell, including
PATH
(relevant) andSDKMAN_*
(probably not?). After it completes, fish copies over the environment. It has to, otherwise no command would have any effect (cf issue #8).Plan
Without changes in SDKMAN! that separate function declaration from environment initialization, it's probably gonna be hacky.
Idea: hard-code resetting the environment into the delegation command (between
source
andsdk
).