fix(RemoteTreeBrowser): add sh -c prefix#64
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request aims to fix compatibility issues for users who have fish shell as their default shell by wrapping remote SSH commands in bash -c to ensure POSIX-compatible shell syntax works correctly. The fish shell doesn't support bash-specific syntax like ${var#pattern}, which is used in the directory browsing commands.
Changes:
- Added
bash -cwrapper to all SSH commands that list remote directories - Updated comments to explain the reason for using
bash -c - Modified command string formatting across multiple functions in tree_browser.lua and browse.lua
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| lua/async-remote-write/tree_browser.lua | Added bash -c wrapper to the load_directory function's SSH command |
| lua/async-remote-write/browse.lua | Added bash -c wrapper to five different directory browsing functions (warm_single_directory, browse_remote_directory, browse_remote_level_based, load_directory_for_tree, load_directory_v2) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1. replace bash -c with sh -c, it should work natively. 2. give shell script strings a better format.
bash -c prefixsh -c prefix
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@inhesrom Hey, I think this is ready to be merged. PR Summary: Fix RemoteTreeBrowser for Fish Shell CompatibilityProblemRemoteTreeBrowser fails with "Failed to load initial tree" when the remote server uses fish shell as the default shell. The shell commands used POSIX/Bash-specific syntax (e.g., ${f#./}) that fish doesn't support. SolutionWrap all shell commands with sh -c '...' to ensure execution in a POSIX-compatible shell, regardless of the user's login shell. New API-- lua/async-remote-write/ssh_utils.lua
ssh_utils.build_list_dir_cmd(path, opts)
-- opts.sorted: boolean (default: true)Key ChangeBefore: local cmd = 'cd ' .. path .. ' && find . -maxdepth 1 | while read f; do ...'After: local cmd = ssh_utils.build_list_dir_cmd(path)
-- Generates: sh -c '...' _ '/path/to/dir' |
|
@YaQia thanks for the submission, will be reviewing soon. |
|
Given that this is a change to the core functionality, can we start by merging this into a test branch for me to pull down and do some manual testing with? Please open another PR into the branch: Thanks again for submitting this, it is very needed! |
|
OK, see #65 |
I use fish as a default shell, so add bash -c is needed for compatibility.