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

Lose boot repl after watch system #115

Open
mudgen opened this issue Oct 16, 2017 · 12 comments
Open

Lose boot repl after watch system #115

mudgen opened this issue Oct 16, 2017 · 12 comments

Comments

@mudgen
Copy link

mudgen commented Oct 16, 2017

I executed this command: boot repl watch system

When I did this I got this display:
[WARNING] No nREPL middleware descriptor in metadata of boot.repl$disable_exception_colors@1fc152d, see clojure.tools.middleware/set-descriptor!
nREPL server started on port 65081 on host 127.0.0.1 - nrepl://127.0.0.1:65081

Starting file watcher (CTRL-C to quit)...

System was not supplied. Will reload code, but not perform restarts.
Elapsed time: 0.011 sec

But now I am not able to use the repl -- it like the display is now only for showing when a file changes. How can I get and use the repl after running boot repl watch system?

@danielsz
Copy link
Owner

You should write a build.boot file with a task. Please look at the examples and adapt to your needs.

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

Hi there. All I want it to do is reload code, which is what it does currently. So it doesn't seem like I need a task for that. I do have a build.boot file written. Now what?

@danielsz
Copy link
Owner

Now what is the question again, Nick?

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

Danielsz thank you for your patience and your help.

I want to be able to use the repl to test things while I write code. When I write code I want the repl to automatically reload code that changes. When I run boot repl watch system the "Start file watcher .." info is displayed. Any time a file changes the output shows that it reloaded. However the REPL is gone and I can no longer use it -- defeating the purpose of using watch system to reload code in the REPL since the REPL is gone.

I am using the command line in Windows 10 and I wonder if that has something to do with it. I have tried searching Google but I don't find anything on this.

Here is a link to a short video that shows the exact problem:
https://www.youtube.com/watch?v=TQsqkzzR-8g&feature=youtu.be&hd=1

@danielsz
Copy link
Owner

danielsz commented Oct 16, 2017

Hi Nick,

This is a boot gotcha. Because you're using the watch task, you don't see the REPL prompt, but that is by design. All you need to do is connect to the REPL on port 52084.

Anticipating the next question, here is how you connect to the REPL in Cursive (look for the section on remote REPLs).

Good luck.

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

Hi Danielsz,

I see what you are saying and it makes sense. I am glad it is designed that way. I am able to start a REPL server from the command line and make a remote connection to the REPL in Cursive but the Cursive REPL does not see the code changes. It seems that when I make a code change it gets reloaded in the REPL server but the REPL connection in Cursive does not see it.

I don't think this is a problem just with the Cursive REPL because I started another command line and made a client connection to the REPL server from the command line and it also did not see code changes.

Here is a video that shows the problem:
https://www.youtube.com/watch?v=AHUOaQWr5ZA&feature=youtu.be&hd=1

I appreciate your help.

@danielsz
Copy link
Owner

danielsz commented Oct 16, 2017

Hi Nick,

You need the -a option, too.
As in:

$ boot watch system -a repl -s

Good luck!

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

Cool, I added -a. Now when a source file changes this additional text is displayed:

:refreshing
Unmapping namespaces: (ignition-project.core)
Recompiling namespaces: (ignition-project.core)
Elapsed time: 0.037 sec

That looks good but I still don't see changes in the client REPL that is connected to the REPL server.

My command looks like this:
boot watch system -a repl -n ignition-project.core -p 6000 -s

Any suggestions now?

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

I noticed that I can make changes to the source code and then when I connect with a client REPL the client REPL will see those changes. But then if I make changes to the source code the existing client REPL does not see those changes -- I have to close the client REPL and make a new client REPL to connect to the REPL server in order to see the new changes. What can I do? I appreciate your help.

@mudgen
Copy link
Author

mudgen commented Oct 16, 2017

Hey, the same problem is occurring with boot-refresh and the author says he is aware of the problem but doesn't know why it is happening. You can see here: samestep/boot-refresh#5 Apparently boot-refresh works in Emacs but not from a command line.

@danielsz
Copy link
Owner

Hi Nick,

Thank you for reporting this. I'm afraid I don't have a good answer for you at this time. Under Emacs + CIDER this works as intended, and I don't know what special magic is making the difference. Maybe CIDER own's nREPL middleware. I'm actually interested to investigate this issue. Due to the many moving parts of nREPL tooling, it's a bit like going down a rabbit hole. This can only happen on my free time which is few and far between.

It's too bad that you're having to deal with those bumps in the road when just starting out, but hold on and things will fall into place. Please update this thread if something comes up on your side. Thank you!

@mudgen
Copy link
Author

mudgen commented Oct 17, 2017

Hi Danielz,

I understand and appreciate your work and what you are doing. Thank you for the encouragement. I love clojure so I'll keep going and smooth the road for those that follow. I will update the thread with what develops.

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

No branches or pull requests

2 participants