Skip to content

Commit c28644d

Browse files
authored
Merge pull request #234 from JuliaInterop/precompile-port
Use an arbitrary available port during precompilation
2 parents f278afd + c97d9d7 commit c28644d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ZMQ.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ import PrecompileTools: @compile_workload
5858

5959
s2=Socket(REQ)
6060

61-
ZMQ.bind(s1, "tcp://*:5555")
62-
ZMQ.connect(s2, "tcp://localhost:5555")
61+
ZMQ.bind(s1, "tcp://localhost:*")
62+
# Strip the trailing null-terminator
63+
last_endpoint = s1.last_endpoint[1:end - 1]
64+
# Parse the port from the endpoint
65+
port = parse(Int, split(last_endpoint, ":")[end])
66+
ZMQ.connect(s2, "tcp://localhost:$(port)")
6367

6468
msg = Message("test request")
6569

0 commit comments

Comments
 (0)