elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.62k stars 300 forks source link

TTY modes left in inconsistent state when external command is killed #1182

Open krader1961 opened 3 years ago

krader1961 commented 3 years ago

Consider this interactive Elvish scenario:

1) You run an external command (e.g., an editor such as vim) that modifies the TTY behavior.

1) That command dies in a manner which doesn't give it an opportunity to restore the TTY behavior that existed before it changed that behavior.

You are now left with an interactive Elvish session that may, or may not, be usable. I noticed this while working on issue #661. See also issue #232 which is essentially the same issue but was limited to what happens when Elvish launches a /bin/sh rescue shell.

krader1961 commented 3 years ago

Note that this affects the proper setup of the Windows console. Changing the sanitize function in pkg/cli/term/setup_windows.go to call setup(in, out) "fixes" the correct rendering of ANSI color sequences on Windows. See issue #1165. The question is how to properly setup the TTY at both startup and after an external command terminates.

krader1961 commented 7 months ago

This is still broken. See also issues #732 and #1469.