-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Confused about remote_eval
and string literals
#29
Comments
The weird part is that I don't see any errors, so I'm not sure what's happening. |
I think your confusion here is due to the environment in which DaemonMode vs RemoteREPL evaluate their commands. RemoteREPL is server-centred by default. This means that code
DaemonMode is client-centred by default. This means that code
With this in mind, DaemonMode is more suited for your use case here. On the other hand, you could have debugged this issue interactively with RemoteREPL (it's a REPL, after all!). You might have seen something like the following: chris@xyz:~/tmp$ pwd
/home/chris/tmp
chris@xyz:~/tmp$ julia -q julia> using RemoteREPL
julia> connect_repl()
REPL mode remote_repl initialized. Press > to enter and backspace to exit.
julia@localhost> format_file("badfile1.jl")
ERROR: SystemError: opening file "badfile1.jl": No such file or directory
Stacktrace:
[1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
...
julia@localhost> pwd()
"/home/chris" |
For your use case, the following should work ok. The trick is to compute the
The fact that I also opened #30 which would help with error reporting if JuliaFormatter writes to |
Thanks for explaining, it makes sense. I'll stick to using DaemonMode for this for now, it also seems to be slightly faster (haven't benchmarked, just a hunch). Thoughts on exporting I was reading about sockets and streams the other day because it's all quite new to me, and it seems like it could be nice to have DaemonMode or this package falling back to unix sockets instead of TCP if both server and client are on the same (unix) host (better performance, possibly better secrity?). I wonder if you've tried using unix sockets before, or if you have some insights about that. |
Probably DaemonMode has lower startup time due to precompiling some things? Or perhaps because they don't need an ssh tunnel for transport over the open internet! Better startup time would be nice to have in RemoteREPL too, but it hasn't been a big priority yet as the use cases are different.
I think that would be fine, though I somehow feel it's not a great API :-)
Yes this definitely makes sense and I've been vaguely planning to do it at some point. Using unix domain sockets or windows named pipes would make sense on localhost and the
The main advantage is that it makes RemoteREPL secure to use on multi-user servers (at least on unix where you can use filesystem permissions to protect against other users on the system. I'm not sure about windows named pipes.). It should also help a bit with startup time. |
I opened an issue about this #31 |
By the way, startup time for the client can be greatly reduced using the https://github.com/c42f/RemoteREPL.jl/blob/main/bin/julia-r This sets some Julia options to make startup almost instant. |
It's really just a question, I'm not sure why this doesn't work. Today I was looking for a way to have a daemon running JuliaFormatter so I can occasionally quickly reformat messy files. I've got something that works when using DaemonMode.jl but not using this package.
Starting the server
DaemonMode.jl version:
RemoteREPL.jl version:
Client (code formatter script)
DaemonMode.jl version:
RemoteREPL.jl version:
Test file with bad formatting
The DaemonMode.jl version works as expected. The RemoteREPL.jl version connects to the server and then exits, but the code stays unformatted. From what I can see, DaemonMode just
println
s the string to the socket, but here you have some more processing going on. I wonder if that is causing an issue with the triple-quoted strings or something?The text was updated successfully, but these errors were encountered: