]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40280: Emscripten has no support for subprocesses (GH-29872)
authorChristian Heimes <christian@python.org>
Thu, 2 Dec 2021 09:17:37 +0000 (11:17 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Dec 2021 09:17:37 +0000 (01:17 -0800)
Fixes ``platform`` and ``help()`` on emscripten.

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
Lib/platform.py
Lib/pydoc.py

index 9e9b42238fb76c44b38e38d8eed28c62b8969181..3f3f25a2c92d3b6d68ed20672da107b5e4137bf9 100755 (executable)
@@ -607,7 +607,10 @@ def _syscmd_file(target, default=''):
         # XXX Others too ?
         return default
 
-    import subprocess
+    try:
+        import subprocess
+    except ImportError:
+        return default
     target = _follow_symlinks(target)
     # "file" output is locale dependent: force the usage of the C locale
     # to get deterministic behavior.
@@ -746,7 +749,10 @@ class _Processor:
         """
         Fall back to `uname -p`
         """
-        import subprocess
+        try:
+            import subprocess
+        except ImportError:
+            return None
         try:
             return subprocess.check_output(
                 ['uname', '-p'],
index 3a2ff218f8319a1419d747ae579d0a3a1d698e21..7d52359c9a0ce94bde9ed3ff0e247e55826f2d75 100755 (executable)
@@ -1556,6 +1556,8 @@ def getpager():
         return plainpager
     if not sys.stdin.isatty() or not sys.stdout.isatty():
         return plainpager
+    if sys.platform == "emscripten":
+        return plainpager
     use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')
     if use_pager:
         if sys.platform == 'win32': # pipes completely broken in Windows