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

Fix error testing remote with echo #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TakodaS
Copy link

@TakodaS TakodaS commented Jul 11, 2024

RemoteStart producing the following error:

Testing remote connection' failed.
stack traceback:
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:974: in function '_handle_job_completion'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:1019: in function 'run_command'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:142: in function '_setup_workspace_variables'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:872: in function '_launch_neovim'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:883: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:882>
	[C]: in function 'xpcall'
	.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:759: in function <.../remote-nvim.nvim/lua/remote-nvim/providers/provider.lua:758> 

FAILED JOB OUTPUT (SO FAR)
bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file

I added an extra line of debug information to get the raw ssh command executed:

DEBUG Thu 11 Jul 2024 15:03:13 BST .repro/data/nvim/lazy/remote-nvim.nvim/lua/remote-nvim/providers/executor.lua:76: Executor running command  "ssh remote 'echo '\\''Hello'\\'''" with options {
  stdout_cb = <function 1>
}

The error is produced because "echo 'Hello'" is a nasty nested string that causes undefined behavior even with vim.fn.shellescape. Perhaps it's better to use "pwd"?

"echo 'Hello'" is a nasty nested string that causes undefined behavior
with vim.fn.shellescape. Much better to use "pwd"!

Oh, and I added an extra line of debug information to get the raw ssh
command executed.
@amitds1997
Copy link
Owner

amitds1997 commented Jul 12, 2024

Thanks for raising this PR! Before we work on this further, I would like to discuss (in #157) and probably try to understand why an echo command did not work if it works on a lot of the system; as this might creep up later in future commands that we might add (and they for sure would be more complicated than echo "Hello World").

The reason for choosing echo is that it's universal (just like pwd).

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

Successfully merging this pull request may close these issues.

2 participants