Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make jupyter config retrieval silent #207

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading