Fix ~/.ros_ardusub_env/env breaking on zsh#47
Open
brendon-albacore wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current
envfile unconditionally doessource /opt/ros/jazzy/setup.bash. That setup script uses${BASH_SOURCE[0]}to find its own location, which is empty in zsh - soAMENT_CURRENT_PREFIXresolves to whatever the shell's cwd is at startup (usually$HOME), and you get ano such file or directory: $HOME/setup.sherror on every new zsh shell. ROS doesn't get sourced via this path; the export lines below still apply, so it sort of half-works and is easy to miss.The installer already picks the right rc file based on
$TARGET_SHELL, but theenvbody was hardcoded to bash.Fix
Detect the shell at source time inside
envand picksetup.zshvssetup.bashaccordingly:Doing it at source time (rather than at install time via
TARGET_SHELL) means the sameenvworks if someone happens to source it from the other shell, and survives a default-shell change without a reinstall.This could get unwieldy if extended for each shell a user can source. Might recommend removing this source line, and assume user sources in their
.*rcfiles - or doing a check, and confirming it is sourced in the rc files prior to writing toenvScope
One-line behaviour change in the heredoc that writes
env. No reformatting, no other touches.Tests
No new tests. Verified manually:
ros2available,AMENT_PREFIX_PATHpopulated.