Skip to content

Commit 97f5b66

Browse files
labathTeemperor
authored andcommitted
[lldb/pexpect] Force-set the TERM environment variable
In some environments (typically, buildbots), this variable may not be available. This can cause tests to behave differently. Explicitly set the variable to "vt100" to ensure consistent test behavior. It should not matter that we do not inherit the process TERM variable, as the child process runs in a new virtual terminal anyway.
1 parent 8762dfa commit 97f5b66

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lldb/packages/Python/lldbsuite/test/lldbpexpect.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import
33

44
# System modules
5+
import os
56
import sys
67

78
# Third-party modules
@@ -30,16 +31,21 @@ def expect_prompt(self):
3031
def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
3132
logfile = getattr(sys.stdout, 'buffer',
3233
sys.stdout) if self.TraceOn() else None
34+
3335
args = ['--no-lldbinit', '--no-use-colors']
3436
for cmd in self.setUpCommands():
3537
args += ['-O', cmd]
3638
if executable is not None:
3739
args += ['--file', executable]
3840
if extra_args is not None:
3941
args.extend(extra_args)
42+
43+
env = dict(os.environ)
44+
env["TERM"]="vt100"
45+
4046
self.child = pexpect.spawn(
4147
lldbtest_config.lldbExec, args=args, logfile=logfile,
42-
timeout=timeout, dimensions=dimensions)
48+
timeout=timeout, dimensions=dimensions, env=env)
4349
self.expect_prompt()
4450
for cmd in self.setUpCommands():
4551
self.child.expect_exact(cmd)

0 commit comments

Comments
 (0)