Skip to content

Terminal settings not restored after panics/crashes #1459

@jmonroynieto

Description

@jmonroynieto

Describe the bug
When the application exits abnormally (crashes or panics) the terminal is left in a broken state. Basic shell interactivity is lost: typed commands are not echoed (reflected as I type), line alignment is completely chaotic, and the general usability of the terminal is severely degraded. This persists until I explicitly run stty sane or a similar to restore the expected settings. Abrupt interruptions have to be handled by the user.

For the sake of documentation these are all the options that are off after exectution:
stty brkint ignpar icrnl ixon opost isig icanon iexten echo

I am using Bash via terminator emulator on manjaro. Also applies to xfce terminal.

To Reproduce
set up a crash or a panic during the tea program execution. out-of-range Index work well.

Source Code
I noticed that the panics are handled with tea.program.recoverFromPanic() link. I count not find a execution route from there into restoreTerminal(); perhaps the solution would be to add it to panic handling.

func (p *Program) RestoreTerminal() error {

Additional Context
I know... I know... it would be more logical to not have my program crash or panic. I'm trying, ok?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions