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

Uninstallation only removes binary in WSL but not files and registry keys on Windows host #1576

Closed
xudyang1 opened this issue Jan 20, 2024 · 1 comment

Comments

@xudyang1
Copy link
Contributor

  • OS Version: Windwos 10 22H2
  • Browser Version: 120.0.6099.225
  • Browser Addon Version: 0.2.15
  • Neovim Plugin Version: 0.2.15

What I tried to do

Run :lua vim.fn["firenvim#uninstall"]() in neovim on WSL2

What happened

Only stdpath('data')/firenvim/firenvim or $HOME/.local/share/firenvim/firenvim binary in WSL2 gets removed. Files under %LOCALAPPDATA%/firenvim/ and registry keys on Windows host are not removed.

xudyang1 added a commit to xudyang1/firenvim that referenced this issue Jan 20, 2024
Firenvim on Windows relys on powershell scripts to run registry keys installation and
uninstallation. Here are the codes:

https://github.com/glacambre/firenvim/blob/8c6c00aae7e5762cbcb4cd0df5848e959c4a9572/autoload/firenvim.vim#L890

https://github.com/glacambre/firenvim/blob/8c6c00aae7e5762cbcb4cd0df5848e959c4a9572/autoload/firenvim.vim#L958

During debugging, I add `echo o` right after calling the `system`
function, the output shows error

```text
Cannot load PSReadline module.  Console is running without PSReadline.
```

But weirdly, `v:shell_error` is still `0`. `PSReadline` is a module
usually installed for interactive prompt usage. `Powershell.exe`
provides option `-NonInterative` for running automated scripts in
non-interactive shell. Adding the `-NonInteractive` option fixes glacambre#1547
as the scripts run successfully without error.

> [!NOTE]
> This pull request only fixes firenvim installation on Windows host and
WSL2 environment. Uninstallation scripts run successfully when running
nvim on the host (`%LOCALAPPDATA/firenvim/*` files and
corresponding registry keys are removed); run `firenvim#uninstall()` on
WSL side only removes the binary in WSL
(`stdpath('data')/firenvim` in WSL or
`$HOME/.local/share/firenvim/firenvim`)
>
> A separate issue glacambre#1576 tracks the uninstallation bug on WSL side
glacambre pushed a commit that referenced this issue Jan 20, 2024
Firenvim on Windows relys on powershell scripts to run registry keys installation and
uninstallation. Here are the codes:

https://github.com/glacambre/firenvim/blob/8c6c00aae7e5762cbcb4cd0df5848e959c4a9572/autoload/firenvim.vim#L890

https://github.com/glacambre/firenvim/blob/8c6c00aae7e5762cbcb4cd0df5848e959c4a9572/autoload/firenvim.vim#L958

During debugging, I add `echo o` right after calling the `system`
function, the output shows error

```text
Cannot load PSReadline module.  Console is running without PSReadline.
```

But weirdly, `v:shell_error` is still `0`. `PSReadline` is a module
usually installed for interactive prompt usage. `Powershell.exe`
provides option `-NonInterative` for running automated scripts in
non-interactive shell. Adding the `-NonInteractive` option fixes #1547
as the scripts run successfully without error.

> [!NOTE]
> This pull request only fixes firenvim installation on Windows host and
WSL2 environment. Uninstallation scripts run successfully when running
nvim on the host (`%LOCALAPPDATA/firenvim/*` files and
corresponding registry keys are removed); run `firenvim#uninstall()` on
WSL side only removes the binary in WSL
(`stdpath('data')/firenvim` in WSL or
`$HOME/.local/share/firenvim/firenvim`)
>
> A separate issue #1576 tracks the uninstallation bug on WSL side
xudyang1 added a commit to xudyang1/firenvim that referenced this issue Jan 23, 2024
The uninstallation logic is similar to `firenvim#install`:
> At first, is_wsl is set to false, even on WSL. This lets us uninstall
firenvim on the wsl side.
> Then, we set is_wsl to true if we're on wsl and launch
firenvim#uninstall again, uninstalling things on the host side.
glacambre pushed a commit that referenced this issue Jan 23, 2024
The uninstallation logic is similar to `firenvim#install`:
> At first, is_wsl is set to false, even on WSL. This lets us uninstall
firenvim on the wsl side.
> Then, we set is_wsl to true if we're on wsl and launch
firenvim#uninstall again, uninstalling things on the host side.
@xudyang1
Copy link
Contributor Author

Closed by #1581

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

No branches or pull requests

1 participant