Commit a2c5cc8
Handle CLI server stdin EPIPE on teardown
The CLI server process's stdin can emit an asynchronous 'error' during
teardown: killProcessIfRunning() writes a "shutdown" request and then
immediately end()s and kill()s the process, so on Windows the buffered
write can complete with EPIPE once the read end closes. With no listener
this became an unhandled error that faulted whichever operation was
running, causing the flaky "should restart the database and run a query"
failures in the Windows cli-integration tests (the restart command also
restarts the CLI server via cliServer.restartCliServer()).
Attach an 'error' listener to the CLI server's stdin inside
killProcessIfRunning(), scoped to teardown, before issuing the shutdown
write. The process is killed and dereferenced immediately afterwards, so
the listener is short-lived and does not accumulate. Because it only
exists during teardown, stdin errors during an active command retain
their existing behaviour and cannot be masked.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 90105d62-02ab-405e-9c95-10466c9718141 parent 3c16a18 commit a2c5cc8
1 file changed
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
316 | 331 | | |
317 | 332 | | |
318 | 333 | | |
319 | | - | |
320 | | - | |
| 334 | + | |
| 335 | + | |
321 | 336 | | |
322 | 337 | | |
323 | 338 | | |
| |||
328 | 343 | | |
329 | 344 | | |
330 | 345 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
335 | 350 | | |
336 | 351 | | |
337 | 352 | | |
| |||
0 commit comments