Skip to content

Commit

Permalink
fix #28499, calling cluster_cookie before cluster starts (#28656)
Browse files Browse the repository at this point in the history
(cherry picked from commit 630f53a)
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 8, 2018
1 parent bbd310f commit f4c81c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/Distributed/src/cluster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,15 @@ end
Return the cluster cookie.
"""
cluster_cookie() = LPROC.cookie
cluster_cookie() = (init_multi(); LPROC.cookie)

"""
cluster_cookie(cookie) -> cookie
Set the passed cookie as the cluster cookie, then returns it.
"""
function cluster_cookie(cookie)
init_multi()
# The cookie must be an ASCII string with length <= HDR_COOKIE_LEN
@assert isascii(cookie)
@assert length(cookie) <= HDR_COOKIE_LEN
Expand Down
2 changes: 2 additions & 0 deletions stdlib/Distributed/test/distributed_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Test, Distributed, Random, Serialization, Sockets
import Distributed: launch, manage

@test cluster_cookie() isa String

include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl"))

@test Distributed.extract_imports(:(begin; import Foo, Bar; let; using Baz; end; end)) ==
Expand Down

0 comments on commit f4c81c5

Please sign in to comment.