With julia 1.6.0 everything works as expected, however the output doesn’t show in 1.6.1:
1.6.0:
1.6.1:
What’s going on here, is this a bug in julia and/or PlutoUI?
Code to reproduce below
begin
using Pkg;
Pkg.add("PlutoUI")
using PlutoUI
end
with_terminal() do
println(VERSION)
Pkg.activate(".")
end
with_terminal() do
Pkg.status()
end
Confirmed:
julia-1.6.1:
julia-1.6.0:
Pluto v0.14.5
Seems worth reporting to Issues · JuliaPluto/PlutoUI.jl · GitHub
1 Like
Thanks, yes I was reluctant to filing an issue at PlutoUI if it was indeed a Julia issue.
I looks like import Pkg; Pkg.DEFAULT_IO[] = stdout
should be a workaround, but it seems to make no difference for me in 1.6.1, unfortunately.
Since the redirection here happens in with_terminal
you need to use this inside that, or simply pass stdout
explicitly, e.g.
with_terminal() do
Pkg.status(; io = stdout)
end
That doesn’t work, unfortunately, maybe something else is going on here as well?
1 Like
Looks like a Pluto bug then, since this also fails (prints to the wrong stdout):
with_terminal() do
println(stdout, "hello, world")
end
Thanks, that’s the same behavior in 1.6.0, though.
I gave it a shot in the latest nightly, where it works fine again, so it looks like it might be fixed with PR mentioned above:
Yea, since it is a bug in Pluto I am guessing it applies to all Julia versions.
Right. It has to do with PlutoUI’s with_terminal
using the Suppressor.jl
macro @capture_out
to capture the stdout, I think, but I couldn’t figure out exactly what the problem was.
In case anyone wants to have a closer look, that is.
Hi, still no solution to this issue? Does that mean that with_terminal can’t be used in new versions of Pluto?
nilshg
March 21, 2022, 9:15am
12
Newer Pluto version actually capture output to the terminal directly and display it in the notebook without any user intervention:
Then I don’t understand what I do wrong. In my case:
Pkg.status() (in notebook)
[7f904dfe] PlutoUI v0.7.37 (in terminal, nothing shows up in notebooks)
From worker 2: [b77e0a4c] InteractiveUtils
From worker 2: [d6f4376e] Markdown
From worker 2: [44cfe95a] Pkg
From worker 2: [de0858da] Printf
nilshg
March 21, 2022, 11:03am
14
Which Pluto version are you using?