sendMessage sends a JSON message to the custom adapter process
(ctx *customAdapterWorkerContext, req interface{})
| 177 | |
| 178 | // sendMessage sends a JSON message to the custom adapter process |
| 179 | func (a *customAdapter) sendMessage(ctx *customAdapterWorkerContext, req interface{}) error { |
| 180 | b, err := json.Marshal(req) |
| 181 | if err != nil { |
| 182 | return err |
| 183 | } |
| 184 | a.Trace("xfer: Custom adapter worker %d sending message: %v", ctx.workerNum, string(b)) |
| 185 | // Line oriented JSON |
| 186 | b = append(b, '\n') |
| 187 | _, err = ctx.stdin.Write(b) |
| 188 | return err |
| 189 | } |
| 190 | |
| 191 | func (a *customAdapter) readResponse(ctx *customAdapterWorkerContext) (*customAdapterResponseMessage, error) { |
| 192 | line, err := ctx.bufferedOut.ReadString('\n') |
no test coverage detected