Skip to content

Commit 136ee92

Browse files
authored
Fix #3309 (#3343)
1 parent bf05bee commit 136ee92

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

src/packages/Packages.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,12 @@ end
704704

705705
function with_io_setup(f::Function, notebook::Notebook, iolistener::IOListener)
706706
startlistening(iolistener)
707-
PkgCompat.withio(notebook.nbpkg_ctx, IOContext(iolistener.buffer, :color => true, :sneaky_enable_tty => true)) do
707+
PkgCompat.withio(notebook.nbpkg_ctx, IOContext(
708+
iolistener.buffer,
709+
:color => true,
710+
:force_fancyprint => true, # https://github.com/JuliaLang/julia/pull/58887
711+
:sneaky_enable_tty => true, # fallback for the flag above
712+
)) do
708713
withinteractive(false) do
709714
f()
710715
end

src/packages/PkgCompat.jl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,17 @@ function withio(f::Function, ctx::PkgContext, io::IO)
162162
end
163163
end
164164

165-
# I'm a pirate harrr 🏴‍☠️
166-
@static if isdefined(Pkg, :can_fancyprint)
167-
Pkg.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
168-
get(io, :sneaky_enable_tty, false) === true
169-
end
170-
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
171-
Base.Precompilation.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
172-
get(io, :sneaky_enable_tty, false) === true
165+
@static if !(v"1.11.7" <= VERSION < v"1.12.0-aaa" || VERSION >= v"1.12.0-rc1")
166+
# Versions that do no include https://github.com/JuliaLang/julia/pull/58887
167+
# I'm a pirate harrr 🏴‍☠️
168+
@static if isdefined(Pkg, :can_fancyprint)
169+
Pkg.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
170+
get(io, :sneaky_enable_tty, false) === true
171+
end
172+
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
173+
Base.Precompilation.can_fancyprint(io::Union{IOContext{IOBuffer},IOContext{Base.BufferStream}}) =
174+
get(io, :sneaky_enable_tty, false) === true
175+
end
173176
end
174177

175178
###

src/packages/precompile_isolated.jl

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ function precompile_isolated(
1111
import Pkg
1212
popfirst!(LOAD_PATH)
1313
14-
out_stream = IOContext(stdout, :color => true)
15-
# I'm a pirate harrr 🏴‍☠️
16-
@static if isdefined(Pkg, :can_fancyprint)
17-
Pkg.can_fancyprint(io::IO) = true
18-
end
19-
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
20-
Base.Precompilation.can_fancyprint(io::IO) = true
14+
out_stream = IOContext(
15+
stdout,
16+
:color => true,
17+
# Look at that I put a feature in Julia! 😎
18+
# https://github.com/JuliaLang/julia/pull/58887
19+
:force_fancyprint => true,
20+
)
21+
22+
@static if !(v"1.11.7" <= VERSION < v"1.12.0-aaa" || VERSION >= v"1.12.0-rc1")
23+
# Versions that do no include https://github.com/JuliaLang/julia/pull/58887
24+
# I'm a pirate harrr 🏴‍☠️
25+
@static if isdefined(Pkg, :can_fancyprint)
26+
Pkg.can_fancyprint(io::IO) = true
27+
end
28+
@static if isdefined(Base, :Precompilation) && isdefined(Base.Precompilation, :can_fancyprint)
29+
Base.Precompilation.can_fancyprint(io::IO) = true
30+
end
2131
end
2232
2333
Pkg.activate($(repr(environment)); io=out_stream)

0 commit comments

Comments
 (0)