aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/lib/gdb.exp14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 16c4664..2f95989 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2029,10 +2029,20 @@ proc gdb_file_cmd { arg } {
proc spawn_capture_tty_name { args } {
set result [uplevel builtin_spawn $args]
upvar spawn_out spawn_out
- if { [info exists spawn_out] } {
+ if { [info exists spawn_out(slave,name)] } {
set ::last_spawn_tty_name $spawn_out(slave,name)
} else {
- unset ::last_spawn_tty_name
+ # If a process is spawned as part of a pipe line (e.g. passing
+ # -leaveopen to the spawn proc) then the spawned process is no
+ # assigned a tty and spawn_out(slave,name) will not be set.
+ # In that case we want to ensure that last_spawn_tty_name is
+ # not set.
+ #
+ # If the previous process spawned was also not assigned a tty
+ # (e.g. multiple processed chained in a pipeline) then
+ # last_spawn_tty_name will already be unset, so, if we don't
+ # use -nocomplain here we would otherwise get an error.
+ unset -nocomplain ::last_spawn_tty_name
}
return $result
}