Merge pull request #3790 from salioglu/fix/3718-sessions-stdin-cleanup
fix(cli): clean up stdin after sessions command readline interface closes
This commit is contained in:
commit
5c271e72e7
1 changed files with 8 additions and 0 deletions
|
|
@ -282,6 +282,14 @@ if (cliFlags.messages[0] === 'sessions') {
|
|||
})
|
||||
rl.close()
|
||||
|
||||
// Clean up stdin state left by readline.createInterface().
|
||||
// Without this, downstream TUI initialization gets corrupted listeners and exhibits
|
||||
// duplicate terminal I/O. Match the pattern used after onboarding cleanup.
|
||||
process.stdin.removeAllListeners('data')
|
||||
process.stdin.removeAllListeners('keypress')
|
||||
if (process.stdin.setRawMode) process.stdin.setRawMode(false)
|
||||
process.stdin.pause()
|
||||
|
||||
const choice = parseInt(answer, 10)
|
||||
if (isNaN(choice) || choice < 1 || choice > toShow.length) {
|
||||
process.stderr.write(chalk.dim('Cancelled.\n'))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue