mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.14] gh-142353: Isolate tests from personal GNU Readline init files (GH-142370) (#142634)
gh-142353: Isolate tests from personal GNU Readline init files (GH-142370)
Isolate tests from personal Readline init files using `INPUTRC=/dev/null` trick.
(cherry picked from commit f564654bae)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
8e496013b2
commit
5e425c3f96
1 changed files with 8 additions and 0 deletions
|
|
@ -15,6 +15,14 @@ def run_pty(script, input=b"dummy input\r", env=None):
|
|||
output = bytearray()
|
||||
[master, slave] = pty.openpty()
|
||||
args = (sys.executable, '-c', script)
|
||||
|
||||
# Isolate readline from personal init files by setting INPUTRC
|
||||
# to an empty file. See also GH-142353.
|
||||
if env is None:
|
||||
env = {**os.environ.copy(), "INPUTRC": os.devnull}
|
||||
else:
|
||||
env.setdefault("INPUTRC", os.devnull)
|
||||
|
||||
proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave, env=env)
|
||||
os.close(slave)
|
||||
with ExitStack() as cleanup:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue