()
| 517 | // an 'error' (ECONNRESET/hangup) rather than a clean close; destroying it |
| 518 | // stops a hung fd from busy-spinning the event loop (#799). |
| 519 | const teardown = () => { |
| 520 | try { process.stdin.destroy(); } catch { /* ignore */ } |
| 521 | try { socket.destroy(); } catch { /* ignore */ } |
| 522 | done(); |
| 523 | }; |
| 524 | process.stdin.on('close', teardown); |
| 525 | process.stdin.on('error', teardown); |
| 526 |