diff options
author | Tom de Vries <tdevries@suse.de> | 2025-08-15 14:48:10 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-08-15 14:48:10 +0200 |
commit | 65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3 (patch) | |
tree | a835232b27dcc44b0732c1279287150694ca0b32 | |
parent | 36f8b9785af3c52b745af7174cbe229934dc1cd5 (diff) | |
download | binutils-65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3.zip binutils-65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3.tar.gz binutils-65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3.tar.bz2 |
[gdb/testsuite] Add Term::with_term
Add Term::with_term that allows us to override the default TERM used in
tuiterm:
...
Term::with_term xterm {
Term::clean_restart 12 40
}
...
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 1d60a07..4ef3dc0 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -33,6 +33,9 @@ namespace eval Term { variable _resize_count + variable _TERM + set _TERM "" + variable _alternate variable _alternate_setup set _alternate 0 @@ -1172,13 +1175,24 @@ proc Term::wait_for_line { regexp {pos ""} } { return 1 } +# In BODY, when using Term::with_tuiterm, use TERM instead of the default. + +proc Term::with_term { term body } { + save_vars { Term::_TERM } { + set Term::_TERM $term + uplevel $body + } +} + # Setup the terminal with dimensions ROWSxCOLS, TERM=ansi, and execute # BODY. proc Term::with_tuiterm {rows cols body} { global env stty_init variable _TERM save_vars {env(TERM) env(NO_COLOR) stty_init} { - if { [ishost *-*-*bsd*] } { + if { $Term::_TERM != "" } { + setenv TERM $Term::_TERM + } elseif { [ishost *-*-*bsd*] } { setenv TERM ansiw } else { setenv TERM ansi |