Skip to content

Commit ff0d4ad

Browse files
committed
fixup! Giant refactor to move all state into a Kernel struct
1 parent 89aa4cd commit ff0d4ad

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/IJulia.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ end
144144
# Variable so that display can be done in the correct Msg context
145145
execute_msg::Msg = Msg(["julia"], Dict("username"=>"jlkernel", "session"=>uuid4()), Dict())
146146
# Variable tracking the number of bytes written in the current execution request
147-
stdio_bytes::RefValue{Int} = Ref(0)
147+
stdio_bytes::Int = 0
148148
# Use an array to accumulate "payloads" for the execute_reply message
149149
execute_payloads::Vector{Dict} = Dict[]
150150

@@ -467,7 +467,7 @@ function clear_output(wait=false, kernel=_default_kernel)
467467
empty!(kernel.displayqueue) # discard pending display requests
468468
send_ipython(kernel.publish[], kernel, msg_pub(kernel.execute_msg::Msg, "clear_output",
469469
Dict("wait" => wait)))
470-
kernel.stdio_bytes[] = 0 # reset output throttling
470+
kernel.stdio_bytes = 0 # reset output throttling
471471
return nothing
472472
end
473473

src/execute_request.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function execute_request(socket, kernel, msg)
2727
code = msg.content["code"]
2828
@vprintln("EXECUTING ", code)
2929
kernel.execute_msg = msg
30-
kernel.stdio_bytes[] = 0
30+
kernel.stdio_bytes = 0
3131
silent = msg.content["silent"]
3232
store_history = get(msg.content, "store_history", !silent)
3333
empty!(kernel.execute_payloads)

src/stdio.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ function watch_stream(rd::IO, name::AbstractString, kernel)
7575
while !eof(rd) # blocks until something is available
7676
nb = bytesavailable(rd)
7777
if nb > 0
78-
kernel.stdio_bytes[] += nb
78+
kernel.stdio_bytes += nb
7979
# if this stream has surpassed the maximum output limit then ignore future bytes
80-
if kernel.stdio_bytes[] >= kernel.max_output_per_request[]
80+
if kernel.stdio_bytes >= kernel.max_output_per_request[]
8181
read(rd, nb) # read from libuv/os buffer and discard
82-
if kernel.stdio_bytes[] - nb < kernel.max_output_per_request[]
82+
if kernel.stdio_bytes - nb < kernel.max_output_per_request[]
8383
send_ipython(kernel.publish[], kernel, msg_pub(kernel.execute_msg, "stream",
84-
Dict("name" => "stderr", "text" => "Excessive output truncated after $(kernel.stdio_bytes[]) bytes.")))
84+
Dict("name" => "stderr", "text" => "Excessive output truncated after $(kernel.stdio_bytes) bytes.")))
8585
end
8686
else
8787
@lock buf_lock write(buf, read(rd, nb))

0 commit comments

Comments
 (0)