Comments (10)
Sounds like a cool idea, but you'd have to share a few more details, as I haven't used the socket REPL in a while and I don't even remember how you were supposed to start it. :-)
It's not possible to start the clj tools in jack-in with a main or additional -e options.
So, we basically want to run the app and also start the nREPL server "by the way", right? Maybe you can share how exactly the ideal run invocation would look like?
from nrepl.
Seems we're after:
-Dnrepl.server="{:port 5555 :bind ... :middleware []}"
This would be awesome indeed, so a PR would be most welcomed by me!
from nrepl.
It would seem that clojure's socket repl isn't as magical as I thought. It doesn't start until clojure itself does, relying on the loading of clojure.lang.RT. Getting nrepl to autostart requires finding a way to get something in Java/clojure to reference it, as initialization is lazy.
from nrepl.
@SevereOverfl0w Did you check nrepl.cmdline
namespace? And there is also Java main class. Or is there some reason why -e
would be better?
clj -Sdeps '{:deps {nrepl {:mvn/version "0.4.5"}}}' -m nrepl.cmdline --help
java -cp $(clj -Sdeps '{:deps {nrepl {:mvn/version "0.4.5"}}}' -Spath) nrepl.main
from nrepl.
@Deraen the problem I have currently is that I can't specify -m
and -e
. I think this is a clojure.main limitation.
See:
$ clj -A:user/rebel -Sdeps '{:deps {refactor-nrepl {:mvn/version "2.4.0-SNAPSHOT"} cider/cider-nrepl {:mvn/version "0.18.0"} }}' -e '(require (quote cider-nrepl.main)) (cider-nrepl.main/init [ "refactor-nrepl.middleware/wrap-refactor" "cider.nrepl/cider-middleware"])'
[Rebel readline] Type :repl/help for online help info
user=>
Which doesn't start an nrepl server.
from nrepl.
java -cp $(clj -Sdeps '{:deps {nrepl {:mvn/version "0.4.5"}}}' -Spath) nrepl.main
FYI - I'm currently wondering if we need this at all. I don't really see any benefits from it, but I might be missing something.
from nrepl.
@bbatsov Sorry, I should been explicit. The key thing missing is that I want -A:user/rebel
(which has -m rebel.main
in) to not prevent nrepl from starting.
I want to be able to start a command line REPL (or anything else) without being prevented from starting nREPL simultaneously.
This would be particularly nice for the case where I'm trying to debug a process primarily run via the main (e.g. pack) or for Edge where we're trying to provide a great CLI & nREPL experience out of the box.
from nrepl.
@SevereOverfl0w No, I totally get this now. I was actually facing a similar problem with REPL-y - I want to potentially start a default REPL-y repl using clj
, but it's hard to do it in the current setup. One idea I had to was to check in nrepl.cmdline
if it's on the classpath and use it instead of simple built-in REPL (and I guess we can do the same for rebel
) or maybe to actually create a separate project nrepl.main
that just can depend on all those CLI stuff and provide the great experience. Still, I believe that if we can find a way to start the server with java opts that'd be extremely useful, regardless of the alternatives.
from nrepl.
I'm currently thinking about trying to solve this via a third party with a some kind of "main.hopper" which would in some manner allow you to call multiple mains.
Perhaps if -background-main
or similar was defined adjacently to a -main
then it would be called instead. Alternatively, if the user specifies that it's a "daemonizing main" then perhaps the main could be started in a Thread and it's state monitored in order to determine when it's "done" (e.g. if BLOCKED and stack unchanged for N seconds then assume done). In the case on nrepl this is discordant as we are daemonizing something which un-daemonizes the starting of a server.
from nrepl.
I don't see too much value in adding support for the current way clj
does argument composition as well. It is just not straightforward.
Even if we had nrepl.cmdline -m ... -m ...
(or similar args for JVM opts) one would still need to guess/discover/understand that vectors in different aliases are concatenating in clj
.
I found the idea of nrepl.edn
much better. My 2c.
from nrepl.
Related Issues (20)
- Avoid illegal reflective access HOT 14
- Support TLS server sockets HOT 8
- Get repl statistics (most called functions, time spent on execution..) HOT 1
- [EASY] Reflection Warning (with solution)
- Recommended practices for tools to listen to nREPL evaluations HOT 3
- Can't define dynamic var in nrepl HOT 4
- nrepl transports should `read` with `{:read-cond :allow}` options HOT 2
- project.clj on the main branch is still set to 0.9.0 HOT 2
- Document the -f option to nrepl.cmdline
- java.lang.ArithmeticException: long overflow at nrepl.bencode$read_long.invokeStatic(bencode.clj:128) HOT 9
- test suite fails on MS-Windows
- Please add examples to CLI doc
- Interrupt is broken on JVM 20+ HOT 13
- ClassCastException on re-connect to unix socket HOT 6
- [Request] New release + Docs update HOT 3
- nrepl wrongly prefers ip4 on dual stack systems HOT 4
- Fix bugged (TLS) accept loop HOT 1
- Ensure that the Clojure version is supported HOT 8
- `--interactive` doesn't work with `--socket PATH` HOT 1
- Server Sent Events support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nrepl.