diff --git a/src/serialization/msgpack.jl b/src/serialization/msgpack.jl index 891a4911..5b95d3e5 100644 --- a/src/serialization/msgpack.jl +++ b/src/serialization/msgpack.jl @@ -12,7 +12,6 @@ function real_unsafe_write(io::IOBuffer, data::Array{T}) where T Base.ensureroom(io, nbytes) ptr = (io.append ? io.size + 1 : io.ptr) written = Int(min(nbytes, Int(length(io.data))::Int - ptr + 1)) - towrite = written GC.@preserve data begin Base.unsafe_copyto!(pointer(io.data, ptr), Ptr{UInt8}(pointer(data)), nbytes) end diff --git a/src/server-defaults.jl b/src/server-defaults.jl index d0e2339f..fadf9fe3 100644 --- a/src/server-defaults.jl +++ b/src/server-defaults.jl @@ -19,14 +19,16 @@ function jupyter_running_servers() jupyter = IJulia().JUPYTER # Man, whats up with jupyter?? # They switched between versions from stdout to stderr, and also don't produce valid json as output -.- - json = replace(sprint(io -> run(pipeline(`$jupyter lab list --json`; stderr=io))), "[JupyterServerListApp] " => "") + run_cmd(std, err) = run(pipeline(`$jupyter lab list --json`; stderr=err, stdout=std)) + json = sprint(io -> run_cmd(io, IOBuffer())) if isempty(json) - json = read(`$jupyter lab list --json`, String) + json = sprint(io -> run_cmd(IOBuffer(), io)) if isempty(json) # give up -.- return nothing end end + json = replace(json, "[JupyterServerListApp] " => "") json = replace(json, r"[\r\n]+" => "\n") configs = IJulia().JSON.parse.(split(json, "\n"; keepempty=false)) return configs