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:
parent
860a55afbc
commit
56ed3872f3
1 changed files with 175 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue