forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoreio.jl
31 lines (27 loc) · 1.03 KB
/
coreio.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This file is a part of Julia. License is MIT: https://julialang.org/license
print(xs...) = print(stdout::IO, xs...)
println(xs...) = println(stdout::IO, xs...)
println(io::IO) = print(io, '\n')
struct DevNullStream <: IO end
const devnull = DevNullStream()
isreadable(::DevNullStream) = false
iswritable(::DevNullStream) = true
isopen(::DevNullStream) = true
read(::DevNullStream, ::Type{UInt8}) = throw(EOFError())
write(::DevNullStream, ::UInt8) = 1
unsafe_write(::DevNullStream, ::Ptr{UInt8}, n::UInt)::Int = n
close(::DevNullStream) = nothing
flush(::DevNullStream) = nothing
wait_connected(::DevNullStream) = nothing
wait_readnb(::DevNullStream) = wait()
wait_readbyte(::DevNullStream) = wait()
wait_close(::DevNullStream) = wait()
eof(::DevNullStream) = true
let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR}
global write, unsafe_write
write(io::CoreIO, x::UInt8) = Core.write(io, x)
unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb)
end
stdin = devnull
stdout = Core.stdout
stderr = Core.stderr