MCPcopy Create free account
hub / github.com/cli/cli / close

Method close

script/ghmock/server.go:96–110  ·  view source on GitHub ↗

close stops the server and returns the requests it saw, in order. It waits for TLS handshakes still under way, so a rejected certificate is logged.

()

Source from the content-addressed store, hash-verified

94// close stops the server and returns the requests it saw, in order. It waits
95// for TLS handshakes still under way, so a rejected certificate is logged.
96func (m *mockServer) close() []loggedRequest {
97 m.mu.Lock()
98 m.closing = true
99 m.mu.Unlock()
100 _ = m.srv.Close()
101 m.handshakes.Wait()
102 if m.tunnelSrv != nil {
103 _ = m.tunnelSrv.Close()
104 _ = m.tunnels.Close()
105 }
106 m.handlers.Wait()
107 m.mu.Lock()
108 defer m.mu.Unlock()
109 return append([]loggedRequest(nil), m.requests...)
110}
111
112// discard forgets the requests and response positions recorded so far, such as
113// anything gh did while printing its version.

Callers 3

TestMockServerFunction · 0.45
runBinaryFunction · 0.45
cmdGitFunction · 0.45

Calls 1

CloseMethod · 0.65

Tested by 1

TestMockServerFunction · 0.36