Skip to content

Commit

Permalink
Use require(pkgid, ...) instead of relative require (#29770)
Browse files Browse the repository at this point in the history
Co-authored-by: Jameson Nash <[email protected]>
(cherry picked from commit 6ae6551)
  • Loading branch information
vchuravy authored and KristofferC committed Nov 2, 2018
1 parent f0badf9 commit facd000
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
6 changes: 5 additions & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ function exec_options(opts)
# Load Distributed module only if any of the Distributed options have been specified.
distributed_mode = (opts.worker == 1) || (opts.nprocs > 0) || (opts.machine_file != C_NULL)
if distributed_mode
Core.eval(Main, :(using Distributed))
let Distributed = require(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
Core.eval(Main, :(const Distributed = $Distributed))
Core.eval(Main, :(using .Distributed))
end

invokelatest(Main.Distributed.process_opts, opts)
end

Expand Down
8 changes: 2 additions & 6 deletions base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ unlock(s::LibuvStream) = unlock(s.lock)
rawhandle(stream::LibuvStream) = stream.handle
unsafe_convert(::Type{Ptr{Cvoid}}, s::Union{LibuvStream, LibuvServer}) = s.handle

const Sockets_mod = Ref{Module}()

function init_stdio(handle::Ptr{Cvoid})
t = ccall(:jl_uv_handle_type, Int32, (Ptr{Cvoid},), handle)
if t == UV_FILE
Expand All @@ -233,10 +231,8 @@ function init_stdio(handle::Ptr{Cvoid})
elseif t == UV_TTY
return TTY(handle, StatusOpen)
elseif t == UV_TCP
if !isassigned(Sockets_mod)
Sockets_mod[] = Base.require(Base, :Sockets)
end
return Sockets_mod[].TCPSocket(handle, StatusOpen)
Sockets = require(PkgId(UUID((0x6462fe0b_24de_5631, 0x8697_dd941f90decc)), "Sockets"))
return Sockets.TCPSocket(handle, StatusOpen)
elseif t == UV_NAMED_PIPE
return PipeEndpoint(handle, StatusOpen)
else
Expand Down
15 changes: 15 additions & 0 deletions stdlib/Sockets/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,21 @@ end
end
end

@static if !Sys.iswindows()
# Issue #29234
@testset "TCPSocket stdin" begin
let addr = Sockets.InetAddr(ip"127.0.0.1", 4455)
srv = listen(addr)
s = connect(addr)

@test success(pipeline(`$(Base.julia_cmd()) -e "exit()" -i`, stdin=s))

close(s)
close(srv)
end
end
end

# Issues #18818 and #24169
mutable struct RLimit
cur::Int64
Expand Down

0 comments on commit facd000

Please sign in to comment.