summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-13 19:48:23 (GMT)
committerGitHub <noreply@github.com>2021-07-13 19:48:23 (GMT)
commit425756abdc03263ab3a52b068befd1ddb16c2dd2 (patch)
treefb726cd35e918d769a74610e7c15b20be1e3dcb3
parent9b369c952cbefb064dda6cb781e66cc1b793fffa (diff)
downloadcpython-425756abdc03263ab3a52b068befd1ddb16c2dd2.zip
cpython-425756abdc03263ab3a52b068befd1ddb16c2dd2.tar.gz
cpython-425756abdc03263ab3a52b068befd1ddb16c2dd2.tar.bz2
bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) (GH-27124)
(cherry picked from commit 0ee0a740e12ec8568aafa033aa6bb08b265afe26) Co-authored-by: Konstantin-Glukhov <glukhov.k@gmail.com>
-rwxr-xr-xLib/platform.py1
-rw-r--r--Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst1
2 files changed, 2 insertions, 0 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index d298a42..134fbae 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 0000000..6e074c5
--- /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