Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

[bug] wrong cmd args #2

@Freed-Wu

Description

@Freed-Wu
❯ vi ssh://wzy@localhost:22//home/wzy/
[fern] ERROR: {'stderr': [''], 'args': ['ssh', '-T', '-x', 'wzy@localhost:22', 'cat /home/wzy/'], 'exitval': 143, 'stdout': ['']}
❯ ssh -T -x wzy@localhost:22 cat /home/wzy/
ssh: Could not resolve hostname localhost:22: Name or service not known
❯ ssh -T -x ssh://wzy@localhost:22 cat /home/wzy
cat: /home/wzy: Is a directory
❯ ssh -T -x ssh://wzy@localhost:22 ls /home/wzy/
Applications
Desktop
Documents
Downloads
...

Should add ssh:// prefix, and judge the file type (directory or normal file) then use ls or cat

index e126d13..6b52c24 100644
--- a/autoload/fern_ssh/connection.vim
+++ b/autoload/fern_ssh/connection.vim
@@ -11,7 +11,7 @@ endfunction
 
 function! s:connection_start(args, ...) abort dict
   let options = copy(a:0 ? a:1 : {})
-  let args = ['ssh', '-T', '-x', self.host, s:cmdline(a:args)]
+  let args = ['ssh', '-T', '-x', 'ssh://' . self.host, s:cmdline(a:args)]
   call fern#logger#debug(args)
   return s:Process.start(args, options)
 endfunction

it can fix the prefix bug, for ls and cat, I think a command like test -d $(realpath /home/wzy/Desktop/h) && ls /home/wzy/Desktop/h || cat /home/wzy/Desktop/h to judge filetype may be useful, but directory is different from normal file -- vi should get a files list containing by a directory, then use fern to handle it.

A weird behaviour is Fern /home/wzy/Desktop in vi can work normally -- use Fern to open the directory, Fern /home/wzy/LICENSE cannot work, fern will return a blank buffer only containing a line LICENSE/. Looks like fern think LICENSE is a directory not a normal file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions