JuliaWeb / JuliaWeb/RemoteREPL.jl

Confused about `remote_eval` and string literals

Open
#29 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
145
Forks
17
PR merge metrics
No merged PRs in 30d

Description

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:

```
jl --startup-file=no -e 'using JuliaFormatter,DaemonMode; serve()'
```

RemoteREPL.jl version:

```
jl --startup-file=no -e 'using JuliaFormatter,RemoteREPL; serve_repl()'
```

**Client (code formatter script)**

DaemonMode.jl version:

```
julia --startup-file=no -e "using DaemonMode; runexpr(\"\"\"format_file(\"$1\")\"\"\")"
```

RemoteREPL.jl version:

```
julia --startup-file=no -e "using RemoteREPL; RemoteREPL.remote_eval(\"\"\"format_file(\"$1\")\"\"\")"
```

**Test file with bad formatting**

```jl
begin
"""This is a badly formatted file"""
a = 4
b = 2

c = ( "foo",
"bar")
end
```

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.