From 7d651aa299ad72e0f6df23aa4214b508930ce3c5 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Mon, 6 Aug 2018 17:01:46 +0100 Subject: [PATCH] Remove deprecation of DevNull and rename DevNullStream to DevNull, fix #26132. (#28473) --- base/coreio.jl | 30 +++++++++++++++--------------- base/deprecated.jl | 3 --- base/process.jl | 2 +- base/stream.jl | 2 +- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/base/coreio.jl b/base/coreio.jl index e901cdec10e39..da955e838a015 100644 --- a/base/coreio.jl +++ b/base/coreio.jl @@ -4,21 +4,21 @@ 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 +struct DevNull <: IO end +const devnull = DevNull() +isreadable(::DevNull) = false +iswritable(::DevNull) = true +isopen(::DevNull) = true +read(::DevNull, ::Type{UInt8}) = throw(EOFError()) +write(::DevNull, ::UInt8) = 1 +unsafe_write(::DevNull, ::Ptr{UInt8}, n::UInt)::Int = n +close(::DevNull) = nothing +flush(::DevNull) = nothing +wait_connected(::DevNull) = nothing +wait_readnb(::DevNull) = wait() +wait_readbyte(::DevNull) = wait() +wait_close(::DevNull) = wait() +eof(::DevNull) = true let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR} global write, unsafe_write diff --git a/base/deprecated.jl b/base/deprecated.jl index b06afc82c200b..ed4a780924070 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1327,9 +1327,6 @@ function (r::Regex)(s) occursin(r, s) end -# Issue #25786 -@deprecate_binding DevNull devnull - # PR 25062 @deprecate(link_pipe(pipe; julia_only_read = true, julia_only_write = true), link_pipe!(pipe, reader_supports_async = julia_only_read, writer_supports_async = julia_only_write), diff --git a/base/process.jl b/base/process.jl index df5c321daab7e..0216c70a1616c 100644 --- a/base/process.jl +++ b/base/process.jl @@ -145,7 +145,7 @@ struct FileRedirect end end -rawhandle(::DevNullStream) = C_NULL +rawhandle(::DevNull) = C_NULL rawhandle(x::OS_HANDLE) = x if OS_HANDLE !== RawFD rawhandle(x::RawFD) = Libc._get_osfhandle(x) diff --git a/base/stream.jl b/base/stream.jl index 73ca43432ebb7..df79e77e200c5 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -24,7 +24,7 @@ abstract type LibuvStream <: IO end # . +- Process (not exported) # . +- ProcessChain (not exported) # +- BufferStream -# +- DevNullStream (not exported) +# +- DevNull (not exported) # +- Filesystem.File # +- LibuvStream (not exported) # . +- PipeEndpoint (not exported)