MCPcopy Create free account
hub / github.com/Debian/dcs / MustWrite

Function MustWrite

internal/addrfd/addrfd.go:16–28  ·  view source on GitHub ↗

MustWrite communicates listening address addr to the parent process via the file descriptor number passed to -addrfd, if any. It must be called precisely once.

(addr string)

Source from the content-addressed store, hash-verified

14// file descriptor number passed to -addrfd, if any. It must be called precisely
15// once.
16func MustWrite(addr string) {
17 if *addrfd == -1 {
18 return
19 }
20 log.Printf("%s is listening on %s", os.Args[0], addr)
21 f := os.NewFile(uintptr(*addrfd), "")
22 if _, err := f.Write([]byte(addr)); err != nil {
23 log.Fatal(err)
24 }
25 if err := f.Close(); err != nil {
26 log.Fatal(err)
27 }
28}

Callers 1

ListenAndServeTLSFunction · 0.92

Calls 2

CloseMethod · 0.95
WriteMethod · 0.45

Tested by

no test coverage detected