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

[BUG]: vfox cd doesn‘t work on Windows #238

Open
yanecc opened this issue Apr 24, 2024 · 6 comments
Open

[BUG]: vfox cd doesn‘t work on Windows #238

yanecc opened this issue Apr 24, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@yanecc
Copy link
Contributor

yanecc commented Apr 24, 2024

Version
0.5.3

OS
Windows

Describe the bug
The command vfox cd does not work on Windows. Instead of switching the shell directory as expected, it prints the usage instructions.

Screenshots[optional]

~/Documents/CodeRepo/Project/vfox> vfox cd                                                                                                       04/24/2024 03:15:38 PM
NAME:
   vfox - vfox is a tool for runtime version management.

USAGE:
   vfox [command] [command options]

VERSION:
   0.4.1

DESCRIPTION:
   vfox is a cross-platform version manager, extendable via plugins. It allows you to quickly install and switch between different environment you need via the command line.

COMMANDS:
   config   Setup, view config
   cd       Launch a shell in the VFOX_HOME or SDK directory
   help, h  Shows a list of commands or help for one command
   Plugin:
     info       Show plugin info
     available  Show all available plugins
     update     Update specified plugin, use --all/-a to update all installed plugins
     remove     Remove a plugin
     add        Add a plugin or plugins
   SDK:
     install, i     Install a version of the target SDK
     current, c     Show current version of the target SDK
     use, u         Use a version of the target SDK
     list, ls       List all versions of the target SDK
     uninstall, un  Uninstall a version of the target SDK
     search         Search a version of the target SDK
     env

GLOBAL OPTIONS:
   --debug            show debug information (default: false)
   --help, -h         show help
   --version, -v, -V  print version (default: false)

COPYRIGHT:
   Copyright 2024 Han Li. All rights reserved.
~/Documents/CodeRepo/Project/vfox>
@yanecc yanecc added the bug Something isn't working label Apr 24, 2024
@aooohan
Copy link
Member

aooohan commented Apr 25, 2024

Powershell and Clink are not reproduced, what shell are you using, gitbash?

@yanecc
Copy link
Contributor Author

yanecc commented Apr 25, 2024

Powershell and Clink are not reproduced, what shell are you using, gitbash?

I'm using Powershell, and it can reproduce stably.

PS C:\Users\Sunrise> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

@alenros
Copy link

alenros commented Apr 29, 2024

vfox cd works for me both with PS and PS Core:

Name Value


PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Name Value


PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

@yanecc
Copy link
Contributor Author

yanecc commented May 26, 2024

It doesn't work in git bash either.

Sunrise@Yane MINGW64 ~
$ echo $VFOX_HOME
C:\Users\Sunrise\.version-fox

Sunrise@Yane MINGW64 ~
$ vfox cd
open a new shell failed, err:exec: no command

Sunrise@Yane MINGW64 ~
$ vfox use ruby@3.1.5
Now using ruby@3.1.5.

Sunrise@Yane MINGW64 ~
$ vfox cd ruby
open a new shell failed, err:exec: no command

@yanecc
Copy link
Contributor Author

yanecc commented May 27, 2024

After further exploration, I found that the vfox I compiled myself works in both powershell and nushell, with the path variable correctly assigned to the shell's executable. However, the behavior of vfox installed via Scoop is the same as in Git Bash, where the path variable is empty.

path := strings.TrimPrefix(strings.TrimSpace(string(output)), "ExecutablePath=")

@aooohan
Copy link
Member

aooohan commented May 28, 2024

However, the behavior of vfox installed via Scoop is the same as in Git Bash, where the path variable is empty.

Good catch!

scoop exposes vfox to PATH using a shim, which results in pid put in this function that is not the shell's but the scoop shim.

We may need to modify manifest provided to scoop to expose vfox directly to PATH without using a shim.

https://github.com/ScoopInstaller/Main/blob/2a4ee74939962bdc224e1a1554078e76ca089ca4/bucket/vfox.json#L27

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

No branches or pull requests

3 participants