()
| 404 | } |
| 405 | |
| 406 | stop(): void { |
| 407 | if (this.clearProgressInterval()) { |
| 408 | process.stdout.write(TERMINAL_PROGRESS_CLEAR_SEQUENCE); |
| 409 | } |
| 410 | |
| 411 | // Disable bracketed paste mode |
| 412 | process.stdout.write("\x1b[?2004l"); |
| 413 | |
| 414 | const shouldDisableKittyProtocol = this.keyboardProtocolPushed || this._kittyProtocolActive; |
| 415 | this.clearKeyboardProtocolNegotiationBuffer(); |
| 416 | |
| 417 | // Disable Kitty keyboard protocol if not already done by drainInput() |
| 418 | if (shouldDisableKittyProtocol) { |
| 419 | process.stdout.write("\x1b[<u"); |
| 420 | this.keyboardProtocolPushed = false; |
| 421 | this._kittyProtocolActive = false; |
| 422 | setKittyProtocolActive(false); |
| 423 | } |
| 424 | this.disableModifyOtherKeys(); |
| 425 | |
| 426 | // Clean up StdinBuffer |
| 427 | if (this.stdinBuffer) { |
| 428 | this.stdinBuffer.destroy(); |
| 429 | this.stdinBuffer = undefined; |
| 430 | } |
| 431 | |
| 432 | // Remove event handlers |
| 433 | if (this.stdinDataHandler) { |
| 434 | process.stdin.removeListener("data", this.stdinDataHandler); |
| 435 | this.stdinDataHandler = undefined; |
| 436 | } |
| 437 | this.inputHandler = undefined; |
| 438 | if (this.resizeHandler) { |
| 439 | process.stdout.removeListener("resize", this.resizeHandler); |
| 440 | this.resizeHandler = undefined; |
| 441 | } |
| 442 | |
| 443 | // Pause stdin to prevent any buffered input (e.g., Ctrl+D) from being |
| 444 | // re-interpreted after raw mode is disabled. This fixes a race condition |
| 445 | // where Ctrl+D could close the parent shell over SSH. |
| 446 | process.stdin.pause(); |
| 447 | |
| 448 | // Restore raw mode state |
| 449 | if (process.stdin.setRawMode) { |
| 450 | process.stdin.setRawMode(this.wasRaw); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | write(data: string): void { |
| 455 | process.stdout.write(data); |
nothing calls this directly
no test coverage detected