Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use require(pkgid, ...) instead of relative require #29770

Merged
merged 1 commit into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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