Skip to content

Commit

Permalink
make jupyter config retrieval silent (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Jan 5, 2024
1 parent 56b34e1 commit b33e013
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/serialization/msgpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/server-defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b33e013

Please sign in to comment.