cider
cider copied to clipboard
Problem with jack-in and tramp
When I have a buffer open, project.clj for example, over a tramp connection and I try to jack-in, CIDER somehow replaces lein
with the tramp buffer name. For example:
Starting nREPL server via /ssh\:root\@localhost\#32808\: update-in :dependencies conj \[acyclic/squiggly-clojure\ \"0.1.5\"\] -- update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.12\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.13.0\"\] -- repl :headless...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: /bin/sh: 2: /ssh:root@localhost#32808:: not found
Expected behavior
When M-x cider-jack-in
or M-x cider-jack-in-clojurescript
is run in a tramp buffer CIDER should use lein
to start an nrepl server on the command-line.
Actual behavior
CIDER uses the tramp buffer name in place of lein
on the command-line.
Steps to reproduce the problem
- Use tramp to open a buffer.
- In this buffer run
M-x cider-jack-in
orM-x cider-jack-in-clojurescript
.
Environment & Version information
CIDER version information
CIDER 0.13
Lein/Boot version
lein 2.6.1
Emacs version
25.1.1
Operating system
macOS Sierra
@benedekfazekas Can you look into this? Perhaps you didn't took into account remote buffers in the new jack-in logic or something?
will have a look
had a look. I don't think it is a regression actually. It seems to me that jack in over tramp is kinda half baked, this todo comment perhaps seconds that?! https://github.com/clojure-emacs/cider/blob/master/cider.el#L686
I may be misunderstanding the code but I assume this:
(when-let ((command (or (file-remote-p default-directory)
(executable-find cider-lein-command)
(executable-find (concat cider-lein-command ".bat")))))
(shell-quote-argument command))
will never work for a remote project.clj as it tries to run the remote default directory as a lein command?!
Oh, shit - yeah. I now remember I couldn't quickly figure out how to check for the executable on the remote host. But I remember this check was actually fixing something. :-)
i can put this on my list but cljr hacking comes first now. as a temporary measure we can show an error if the file is remote I guess and point the user towards using cider-connect
to a remote REPL i suppose. there could be also some rabbit holes with remote files (have not grepped cljr issues but we had some problems with them afair)
as a temporary measure we can show an error if the file is remote I guess and point the user towards using cider-connect to a remote REPL
Could I set a variable instead to specify the remote command?
I've committed a potential workaround - on remote hosts we simply assume the command we need is available. Please, try it out.
@bbatsov I don't have a direct answer to your question...but I know that ssh.el
tab completes commands correctly. Looking at ssh-tab-or-complete
shows it calls completion-at-point
. Not sure that's going to help.
I've committed a potential workaround - on remote hosts we simply assume the command we need is available. Please, try it out.
Thanks @bbatsov. I dropped the new cider.el on top of cider.el v0.13, restarted emacs, opened project.clj over tramp, then jacked-in, and still the same problem. What more can I provide to you to help with this?
you might have it compiled. remove cider.elc if it is in the directory
On 13 Oct 2016 5:29 p.m., "Formerly known as tvaughan" < [email protected]> wrote:
I've committed a potential workaround - on remote hosts we simply assume the command we need is available. Please, try it out.
Thanks @bbatsov https://github.com/bbatsov. I dropped the new cider.el on top of cider.el v0.13, restarted emacs, opened project.clj over tramp, then jacked-in, and still the same problem. What more can I provide to you to help with this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/clojure-emacs/cider/issues/1854#issuecomment-253565525, or mute the thread https://github.com/notifications/unsubscribe-auth/AA9Pnvx9ot5lrzIuWHJz5bksFESakN1Yks5qzlxegaJpZM4KJP9s .
I can't imagine how my fix wouldn't be working - it basically returns the name of the command matching the project's type, without trying to resolve it. If this binary exists on the remote host everything should work just fine.
you might have it compiled. remove cider.elc if it is in the directory
Damnit. That was it. It works! Thanks!
Seems that the proper solution for this would be the use of tramp-find-executable
(part of the built-in library tramp-sh.el
.). Down the road we should leverage this.
I've tried cider-jack-in
in remote machine source.
Tramp: Opening connection for <remote host info> using ssh...
Tramp: Sending command `exec ssh -q -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none <remote host info>'
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on <remote host info>
Tramp: Opening connection for <remote host info> using ssh...done
Making nrepl-create-client-buffer-function local to *nrepl-server guestbook* while let-bound!
Making nrepl-use-this-as-repl-buffer local to *nrepl-server guestbook* while let-bound!
Starting nREPL server via lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.13\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[refactor-nrepl\ \"2.4.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.17.0-SNAPSHOT\"\] -- repl :headless :host ::...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: /bin/sh: 2: lein: not found
error in process sentinel: Could not start nREPL server: /bin/sh: 2: lein: not found
I've traced from cider-jack-in
to nrepl-server-sentinel
. Edebugger shows that set-process-coding-system
's parameter, serv-proc
has the message, "Input file descriptor of nrepl-server closed". So, I guess this problem is related set-process-sentinel
. I'm stuck here.
BTW, I already report cider-connect
related issue. I heartily thank you for developing cider. I want to work directly in remote service server. Could I work it with cider?
I see that lein
is not your exec-path
on the remote server. I guess that's what the cause of your problem.
I already set lein
to exec-path
on the remote server.
So, you did something like this https://stackoverflow.com/questions/26630640/tramp-ignores-tramp-remote-path and you verified that tramp sees the remote lein
?
I'm very sorry. My PATH setting placed in .profile
. So I thought Tramp should check this naturally. But it ignored. I was thoughtless. Thank you for the hint.
FYI, with a recent version of cider, I tried to connect to a server and got this message:
nrepl-connect: [nREPL] Direct connection to my.server:43681 failed; try setting ‘nrepl-use-ssh-fallback-for-remote-hosts’ to t
After putting that setting in place, the remote connection works for me.
See https://github.com/clojure-emacs/cider/issues/2703#issuecomment-1679387356