File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,9 @@ func TestServerInterrupt(t *testing.T) {
129
129
}()
130
130
131
131
// send a signal to the server process to terminate it
132
- cmd .Process .Signal (os .Interrupt )
132
+ if err := cmd .Process .Signal (os .Interrupt ); err != nil {
133
+ t .Fatal (err )
134
+ }
133
135
134
136
// wait for the server to exit
135
137
// TODO: use synctest when available
@@ -162,6 +164,11 @@ func TestStdioContextCancellation(t *testing.T) {
162
164
}
163
165
164
166
// Sleep to make it more likely that the server is blocked in the read loop.
167
+ //
168
+ // This sleep isn't necessary for the test to pass, but *was* necessary for
169
+ // it to fail, before closing was fixed. Unfortunately, it is too invasive a
170
+ // change to have the jsonrpc2 package signal across packages when it is
171
+ // actually blocked in its read loop.
165
172
time .Sleep (100 * time .Millisecond )
166
173
167
174
onExit := make (chan struct {})
@@ -170,7 +177,9 @@ func TestStdioContextCancellation(t *testing.T) {
170
177
close (onExit )
171
178
}()
172
179
173
- cmd .Process .Signal (os .Interrupt )
180
+ if err := cmd .Process .Signal (os .Interrupt ); err != nil {
181
+ t .Fatal (err )
182
+ }
174
183
175
184
select {
176
185
case <- time .After (5 * time .Second ):
Original file line number Diff line number Diff line change @@ -318,9 +318,9 @@ func newIOConn(rwc io.ReadWriteCloser) *ioConn {
318
318
// Start a goroutine for reads, so that we can select on the incoming channel
319
319
// in [ioConn.Read] and unblock the read as soon as Close is called (see #224).
320
320
//
321
- // This leaks a goroutine, but that is unavoidable since AFAIK there is no
322
- // (easy and portable) way to guarantee that reads of stdin are unblocked
323
- // when closed.
321
+ // This leaks a goroutine if rwc.Read does not unblock after it is closed,
322
+ // but that is unavoidable since AFAIK there is no (easy and portable) way to
323
+ // guarantee that reads of stdin are unblocked when closed.
324
324
go func () {
325
325
dec := json .NewDecoder (rwc )
326
326
for {
You can’t perform that action at this time.
0 commit comments