File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,16 @@ type StdioTransport struct{}
9090
9191// Connect implements the [Transport] interface.
9292func (* StdioTransport ) Connect (context.Context ) (Connection , error ) {
93- return newIOConn (rwc {os .Stdin , os .Stdout }), nil
93+ return newIOConn (rwc {os .Stdin , nopCloserWriter { os .Stdout } }), nil
9494}
9595
96+ // nopCloserWriter is an io.WriteCloser with a trivial Close method.
97+ type nopCloserWriter struct {
98+ io.Writer
99+ }
100+
101+ func (nopCloserWriter ) Close () error { return nil }
102+
96103// An IOTransport is a [Transport] that communicates over separate
97104// io.ReadCloser and io.WriteCloser using newline-delimited JSON.
98105type IOTransport struct {
@@ -107,6 +114,9 @@ func (t *IOTransport) Connect(context.Context) (Connection, error) {
107114
108115// An InMemoryTransport is a [Transport] that communicates over an in-memory
109116// network connection, using newline-delimited JSON.
117+ //
118+ // InMemoryTransports should be constructed using [NewInMemoryTransports],
119+ // which returns two transports connected to each other.
110120type InMemoryTransport struct {
111121 rwc io.ReadWriteCloser
112122}
You can’t perform that action at this time.
0 commit comments