From 0ee0a740e12ec8568aafa033aa6bb08b265afe26 Mon Sep 17 00:00:00 2001 From: Konstantin-Glukhov Date: Wed, 14 Jul 2021 04:21:48 +0900 Subject: [PATCH] bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) --- Lib/platform.py | 1 + .../NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst diff --git a/Lib/platform.py b/Lib/platform.py index 02152f6fc9b..39c8ad587a8 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -280,6 +280,7 @@ def _syscmd_ver(system='', release='', version='', for cmd in ('ver', 'command /c ver', 'cmd /c ver'): try: info = subprocess.check_output(cmd, + stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL, text=True, shell=True) diff --git a/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst b/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst new file mode 100644 index 00000000000..6e074c59b84 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst @@ -0,0 +1 @@ +Avoid consuming standard input in the :mod:`platform` module \ No newline at end of file