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

[Windows | Shell] Unexpected command output #179

Open
Yurzi opened this issue Nov 14, 2024 · 0 comments
Open

[Windows | Shell] Unexpected command output #179

Yurzi opened this issue Nov 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Yurzi
Copy link

Yurzi commented Nov 14, 2024

Describe the bug

When using Neovide on windows and trying to connect to a remote Linux server , I encountered two errors:

  1. Hardcoded Shell Command
    I have an SSH config file in the default location, and I'm using it to connect to a remote server. However, I'm encountering the following errors.
ERROR 2024/11/15 5:46:31 .repro\data\nvim-data\lazy\remote-nvim.nvim\lua\remote-nvim\providers\ssh\ssh_config_parser.lua:174: Failed to resolve path: "/c/Users/xxx/.ssh/config". Extra info: (SOURCE_FILE="nil")

And then, I find this hardcoded cmd which can not be excueted on default windows os. But I had git installed.

function SSHConfigParser:_expand_path(path, parent_file)
local parent_dir = parent_file and vim.fs.normalize(vim.fs.dirname(parent_file))
local cmd = { "sh", "-c", ("echo %s"):format(path) }
local res, cmd_output
if vim.fn.has("nvim-0.10") == 1 then
res = vim
.system(cmd, {
text = true,
cwd = parent_dir,
})
:wait()

  1. Unexpected Remote Command Return when determining the remote system

This case is even stranger when using SSH to execute remote commands.

The value of cmd_out_lines is "{\27[?9001h\27[?1004h\27[?25l\27[2J\27[m\27[H\27]0;C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe\a\27[?25hLinux x86_64", "\27[?9001l\27[?1004l"}, a table.

function Provider:_get_remote_os_and_arch()
if self._remote_os == nil then
self:run_command("uname -s -m", "Determining OS on remote machine")
local cmd_out_lines = self.executor:job_stdout()
local os_and_arch = vim.split(cmd_out_lines[#cmd_out_lines], " ", { trimempty = true, plain = true })
local os = os_and_arch[1]
self._remote_arch = os_and_arch[2]

my options.lua is below.

local opt = vim.opt

opt.shell = "pwsh"
opt.shellcmdflag = "-command"
opt.shellquote = '"'
opt.shellxquote = ""

To reproduce

Use the repro.lua to
reproduce the issue. This provides me with a better chance to reproduce the issue.
This also provides a sanity check of if the issue is with the plugin or some other part of your configuration.

Incase you cannot and still feel something is off with the plugin, do report. I won't bite!

Steps to reproduce the behavior:

  1. Run nvim -u <repro.lua>
  2. RemoteStart

Expected behavior

A clear and concise description of what you expected to happen.

Screenshot/Screencast(s)

If possible and applicable, add screenshot(s)/screencast.

System information

  • Your local OS: Windows 11 27749.1000
  • Local Neovim version: v0.10.2 release
  • Local Neovide version: v0.13.3
  • Remote host OS (if applicable): Archlinux x86_64
  • Remote Neovim version (if applicable): v0.10.2 release

Additional context

Also encountered problem in Creating custom neovim directories on remote

FAILED JOB OUTPUT (SO FAR)
�[?9001h�[?1004h�[?25l�[2J�[m�[Hzsh:1: bad pattern: ^[[?9001l^[[?1004l/.remote-nvim/scripts
�]0;C:\Program Files\PowerShell\7-preview\pwsh.exe��[?25h�[?9001l�[?1004l
@Yurzi Yurzi added the bug Something isn't working label Nov 14, 2024
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

1 participant