Skip to content

Commit 58ffe7e

Browse files
authored
fix ConsoleLogger with Core IO objects (#41035)
Fixes #40954
1 parent 4a8572f commit 58ffe7e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

base/coreio.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ function repr end
99

1010
struct DevNull <: IO end
1111
const devnull = DevNull()
12-
isreadable(::DevNull) = false
13-
iswritable(::DevNull) = true
14-
isopen(::DevNull) = true
15-
read(::DevNull, ::Type{UInt8}) = throw(EOFError())
1612
write(::DevNull, ::UInt8) = 1
1713
unsafe_write(::DevNull, ::Ptr{UInt8}, n::UInt)::Int = n
1814
close(::DevNull) = nothing
19-
flush(::DevNull) = nothing
20-
wait_readnb(::DevNull) = wait()
2115
wait_close(::DevNull) = wait()
22-
eof(::DevNull) = true
2316

2417
let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR}
25-
global write, unsafe_write
26-
write(io::CoreIO, x::UInt8) = Core.write(io, x)
27-
unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb)
18+
global write(io::CoreIO, x::UInt8) = Core.write(io, x)
19+
global unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb)
20+
21+
CoreIO = Union{CoreIO, DevNull}
22+
global read(::CoreIO, ::Type{UInt8}) = throw(EOFError())
23+
global isopen(::CoreIO) = true
24+
global isreadable(::CoreIO) = false
25+
global iswritable(::CoreIO) = true
26+
global flush(::CoreIO) = nothing
27+
global eof(::CoreIO) = true
28+
global wait_readnb(::CoreIO, nb::Int) = nothing
2829
end
2930

3031
stdin = devnull

0 commit comments

Comments
 (0)