| 500 | } |
| 501 | |
| 502 | private shutdown(reason: string): void { |
| 503 | const error = new Error( |
| 504 | this.stderrTail.length > 0 |
| 505 | ? `${reason}\n${this.stderrTail.join(' | ')}` |
| 506 | : reason, |
| 507 | ) |
| 508 | |
| 509 | for (const pending of this.pendingExecs.values()) { |
| 510 | pending.reject(error) |
| 511 | } |
| 512 | this.pendingExecs.clear() |
| 513 | |
| 514 | this.stdoutReader?.close() |
| 515 | this.stdoutReader = null |
| 516 | |
| 517 | if (this.child && this.child.exitCode === null && !this.child.killed) { |
| 518 | this.child.kill() |
| 519 | } |
| 520 | this.child = null |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | function getOrCreatePythonReplManager( |