internal/mcp: add a command transport for connecting to a sidecar

Add a missing CommandTransport that communicates with a sidecar process
over newline-delimited stdin/stdout, the counterpart to the existing
StdIOTransport.

Add a test using the usual TestMain trick.

Change-Id: I170ba78faf6b6d7fca7da1af11bf92e919b11ed5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/668895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Rob Findley 2025-04-29 15:08:52 +00:00 • committed by Robert Findley
commit 56ed3872f3

View file

@ -227,13 +227,11 @@ type rwc struct {
}
func (r rwc) Read(p []byte) (n int, err error) {
n, err = r.rc.Read(p)
return n, err
return r.rc.Read(p)
}
func (r rwc) Write(p []byte) (n int, err error) {
n, err = r.wc.Write(p)
return n, err
return r.wc.Write(p)
}
func (r rwc) Close() error {