Commit e54d409
committed
fix: strip all ANSI escape seqs in terminal command output
When sudo (or other interactive programs) run via run_terminal_command,
they can emit cursor-movement, scroll-region, alternate-screen and other
VT/ANSI control sequences that bleed into the TUI and corrupt the display
(garbage characters, broken scrolling).
Changes:
- Switch stripColors -> stripAnsi so ALL escape sequences are removed
from captured stdout/stderr, not just SGR color codes (\x1B[...m).
- Strip bare \r characters that sudo uses to erase its password-prompt
line after credentials are accepted.
- Set SUDO_PROMPT to a plain ASCII string so sudo never emits decorated
(colored/formatted) prompts to /dev/tty.
- Default TERM=dumb (when not overridden by the caller) so child
programs like git, less, and man suppress their own color/cursor output.1 parent 088a57e commit e54d409
1 file changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | 188 | | |
| |||
241 | 249 | | |
242 | 250 | | |
243 | 251 | | |
244 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
245 | 258 | | |
246 | 259 | | |
247 | 260 | | |
| |||
0 commit comments