Skip to content

Commit ce87391

Browse files
committed
Fix error testing remote with echo
"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.
1 parent 66fc20f commit ce87391

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lua/remote-nvim/providers/executor.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ local Executor = require("remote-nvim.middleclass")("Executor")
1616
---@field exit_cb function? On exit callback
1717
---@field compression remote-nvim.provider.Executor.JobOpts.CompressionOpts? Compression options; for upload and download
1818

19+
local utils = require("remote-nvim.utils")
1920
---Initialize executor instance
2021
---@param host string Host name
2122
---@param conn_opts? string Connection options (passed when connecting)
2223
function Executor:init(host, conn_opts)
2324
self.host = host
2425
self.conn_opts = conn_opts or ""
2526

27+
self.logger = utils.get_logger()
2628
self._job_id = nil
2729
self._job_exit_code = nil
2830
self._job_stdout = {}
@@ -71,6 +73,7 @@ end
7173
---@param command string Command which should be started as a job
7274
---@param job_opts remote-nvim.provider.Executor.JobOpts
7375
function Executor:run_executor_job(command, job_opts)
76+
self.logger.fmt_debug("Executor running command %s with options %s", command, job_opts)
7477
local co = coroutine.running()
7578
job_opts = job_opts or {}
7679

lua/remote-nvim/providers/provider.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ end
139139
function Provider:_setup_workspace_variables()
140140
if vim.tbl_isempty(self._config_provider:get_workspace_config(self.unique_host_id)) then
141141
self.logger.debug("Did not find any existing configuration. Creating one now..")
142-
self:run_command("echo 'Hello'", "Testing remote connection")
142+
self:run_command("pwd", "Testing remote connection")
143143
self._config_provider:add_workspace_config(self.unique_host_id, {
144144
provider = self.provider_type,
145145
host = self.host,

0 commit comments

Comments
 (0)