MCPcopy Create free account
hub / github.com/encodeous/nylon / writeResponse

Function writeResponse

core/ipc_handler.go:22–36  ·  view source on GitHub ↗
(rw *bufio.ReadWriter, resp *protocol.IpcResponse)

Source from the content-addressed store, hash-verified

20var pjUnmarshal = protojson.UnmarshalOptions{DiscardUnknown: true}
21
22func writeResponse(rw *bufio.ReadWriter, resp *protocol.IpcResponse) error {
23 data, err := pjMarshal.Marshal(resp)
24 if err != nil {
25 return fmt.Errorf("marshal response: %w", err)
26 }
27 _, err = rw.Write(data)
28 if err != nil {
29 return err
30 }
31 _, err = rw.WriteString("\n")
32 if err != nil {
33 return err
34 }
35 return rw.Flush()
36}
37
38func errResponse(msg string) *protocol.IpcResponse {
39 return &protocol.IpcResponse{Ok: false, Error: msg}

Callers 2

HandleNylonIPCFunction · 0.85
handleTraceFunction · 0.85

Calls 2

FlushMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected