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

vf install should quote paths #252

Closed
4 tasks done
cthoyt opened this issue Nov 26, 2024 · 0 comments · Fixed by #253
Closed
4 tasks done

vf install should quote paths #252

cthoyt opened this issue Nov 26, 2024 · 0 comments · Fixed by #253
Labels

Comments

@cthoyt
Copy link
Contributor

cthoyt commented Nov 26, 2024

  • I am using Fish shell version 3.1 or higher.

  • I am using Python version 3.8 or higher.

  • I have searched the issues (including closed ones) and believe that this is not a duplicate. (Support for uv #248 is related to uv, but a different issue)

  • If related to a plugin, I prefixed the issue title with the name of the plugin.

  • OS version and name: MacOS 14.6

  • Fish shell version: 3.7.1

  • VirtualFish version: 2.5.9

Issue

I installed virtualfish using the following:

$ uv tool install virtualfish
$ vf install

Then, I got the following error when either trying to re-source or open a new terminal:

$ exec fish
source: Error encountered while sourcing file '/Users/cthoyt/Library/Application':
source: No such file or directory

I took a look in my ~/.config/fish/conf.d/virtualfish-loader.fish which had the following:

set -g VIRTUALFISH_VERSION 2.5.9
set -g VIRTUALFISH_PYTHON_EXEC /Users/cthoyt/Library/Application Support/uv/tools/virtualfish/bin/python
source /Users/cthoyt/Library/Application Support/uv/tools/virtualfish/lib/python3.11/site-packages/virtualfish/virtual.fish
emit virtualfish_did_setup_plugins

Manual Fix

I was able to fix the issue and return virtualfish to normal working order by quoting the file paths in the second and third lines as in the following:

set -g VIRTUALFISH_VERSION 2.5.9
set -g VIRTUALFISH_PYTHON_EXEC "/Users/cthoyt/Library/Application Support/uv/tools/virtualfish/bin/python"
source "/Users/cthoyt/Library/Application Support/uv/tools/virtualfish/lib/python3.11/site-packages/virtualfish/virtual.fish"
emit virtualfish_did_setup_plugins

Requested update

I think that virtualfish's install command can be improved to determine when quoting is necessary on a path that has spaces, such as ones on MacOS where the python binary might be inside an Application Support subfolder

The two lines to update for my specific situation

f"set -g VIRTUALFISH_PYTHON_EXEC {sys.executable}",
"source {}".format(os.path.join(base_path, "virtual.fish")),

And related, for any plugins:

commands.append(f"source {path}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant