• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #38022

04 Mar 2025 05:23AM UTC coverage: 22.591% (-2.8%) from 25.412%
#38022

push

local

web-flow
docs: Make docs tests pass when run from Main (#57629)

This fixes `using Test; include("test/docs.jl")`. It appears the
prinitng of types in this context changed at some point to always
include the context module, rather than do so conditionally. I do not
know when this happened, but it appears to be there in 1.10 and 1.11 as
far as I can tell. Regardless, this adjusts the test to the current
behavior to make it easier to run individual failing tests in the REPL.

11012 of 48745 relevant lines covered (22.59%)

126983.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/stdlib/Sockets/src/PipeServer.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
mutable struct PipeServer <: LibuvServer
4
    handle::Ptr{Cvoid}
5
    status::Int
6
    cond::Base.ThreadSynchronizer
7
    function PipeServer(handle::Ptr{Cvoid}, status)
×
8
        p = new(handle,
×
9
                status,
10
                Base.ThreadSynchronizer())
11
        associate_julia_struct(p.handle, p)
×
12
        finalizer(uvfinalize, p)
×
13
        return p
×
14
    end
15
end
16

17
function PipeServer()
×
18
    pipe = PipeServer(Libc.malloc(Base._sizeof_uv_named_pipe), StatusUninit)
×
19
    iolock_begin()
×
20
    err = ccall(:uv_pipe_init, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cint), eventloop(), pipe.handle, 0)
×
21
    uv_error("failed to create pipe server", err)
×
22
    pipe.status = StatusInit
×
23
    iolock_end()
×
24
    return pipe
×
25
end
26

27
## server functions ##
28

29
accept(server::PipeServer) = accept(server, PipeEndpoint())
×
30

31
function accept_nonblock(server::PipeServer, client::PipeEndpoint)
×
32
    iolock_begin()
×
33
    if client.status != StatusInit
×
34
        error("client is already in use or has been closed")
×
35
    end
36
    err = ccall(:uv_accept, Int32, (Ptr{Cvoid}, Ptr{Cvoid}), server.handle, client.handle)
×
37
    if err == 0
×
38
        client.status = StatusOpen
×
39
    end
40
    iolock_end()
×
41
    return err
×
42
end
43

44
function accept_nonblock(server::PipeServer)
×
45
    client = PipeEndpoint()
×
46
    uv_error("accept", accept_nonblock(server, client) != 0)
×
47
    return client
×
48
end
49

50
function bind(server::PipeServer, name::AbstractString)
×
51
    iolock_begin()
×
52
    @assert server.status == StatusInit
×
53
    err = ccall(:uv_pipe_bind, Int32, (Ptr{Cvoid}, Cstring),
×
54
                server, name)
55
    if err != 0
×
56
        iolock_end()
×
57
        if err != UV_EADDRINUSE && err != UV_EACCES
×
58
            #TODO: this codepath is currently not tested
59
            throw(_UVError("bind", err))
×
60
        else
61
            return false
×
62
        end
63
    end
64
    server.status = StatusOpen
×
65
    iolock_end()
×
66
    return true
×
67
end
68

69
"""
70
    listen(path::AbstractString) -> PipeServer
71

72
Create and listen on a named pipe / UNIX domain socket.
73

74
!!! note
75
    Path length on Unix is limited to somewhere between 92 and 108 bytes (cf. `man unix`).
76
"""
77
function listen(path::AbstractString)
×
78
    sock = PipeServer()
×
79
    bind(sock, path) || throw(ArgumentError("could not listen on path $path"))
×
80
    return listen(sock)
×
81
end
82

83
function connect!(sock::PipeEndpoint, path::AbstractString)
×
84
    iolock_begin()
×
85
    @assert sock.status == StatusInit
×
86
    req = Libc.malloc(Base._sizeof_uv_connect)
×
87
    uv_req_set_data(req, C_NULL)
×
88
    ccall(:uv_pipe_connect, Cvoid, (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Ptr{Cvoid}), req, sock.handle, path,
×
89
          @cfunction(uv_connectcb, Cvoid, (Ptr{Cvoid}, Cint)))
×
90
    sock.status = StatusConnecting
×
91
    iolock_end()
×
92
    return sock
×
93
end
94

95
"""
96
    connect(path::AbstractString) -> PipeEndpoint
97

98
Connect to the named pipe / UNIX domain socket at `path`.
99

100
!!! note
101
    Path length on Unix is limited to somewhere between 92 and 108 bytes (cf. `man unix`).
102
"""
103
connect(path::AbstractString) = connect(PipeEndpoint(), path)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc