Skip to content

Commit ba605b8

Browse files
authored
Bugfix: record current eval module on client side (#32)
This makes sure the client remembers the current module so that reconnecting works.
1 parent e73b929 commit ba605b8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/client.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function run_remote_repl_command(conn, out_stream, cmdstr)
273273
# Help mode
274274
cmd = (:help, magic[2])
275275
elseif magic[1] == "%module"
276-
mod_ex = parse_input(magic[2])
276+
mod_ex = Meta.parse(magic[2])
277277
cmd = (:in_module, mod_ex)
278278
end
279279
end
@@ -285,6 +285,9 @@ function run_remote_repl_command(conn, out_stream, cmdstr)
285285
result_for_display = Text(value)
286286
end
287287
end
288+
if messageid == :in_module
289+
conn.in_module = mod_ex
290+
end
288291
else
289292
@error "Unexpected response from server" messageid
290293
end

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ try
147147
end""")
148148
@test runcommand("%module TestMod") == "Evaluating commands in module Main.TestMod"
149149
@test runcommand("var_in_test_mod") == "123"
150+
# Artificially force a reconnect so we can test that the current module is remembered
151+
close(conn.socket)
152+
@test runcommand("var_in_test_mod") == "123"
150153
# Test that show() on the remote side uses the eval module as the context
151154
# module in the show IOContext
152155
@test runcommand("SomeStruct") == "SomeStruct"

0 commit comments

Comments
 (0)