]> granicus.if.org Git - python/commitdiff
Issue #14771: Redirect GDB's stdin to avoid messing the terminal settings
authorMartin Panter <vadmium+py@gmail.com>
Sat, 16 Jan 2016 05:07:35 +0000 (05:07 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 16 Jan 2016 05:07:35 +0000 (05:07 +0000)
Otherwise, GDB seems to affect the terminal's foreground process group,
interfering with test_ioctl, which does not expect the foreground process to
change during the test. This change also solves the problem of the tests
being stopped in the shell if test_gdb is run twice in parallel.

Lib/test/test_gdb.py

index 8a56118f963e561644fcaad74cd991082c11c6a0..f157eaeba046f4e34acd4c4ac647f9b3d0c16d2e 100644 (file)
@@ -71,6 +71,8 @@ def run_gdb(*args, **env_vars):
     if (gdb_major_version, gdb_minor_version) >= (7, 4):
         base_cmd += ('-iex', 'add-auto-load-safe-path ' + checkout_hook_path)
     out, err = subprocess.Popen(base_cmd + args,
+        # Redirect stdin to prevent GDB from messing with terminal settings
+        stdin=subprocess.PIPE,
         stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env,
         ).communicate()
     return out, err