Skip to content

Commit cb2b3c8

Browse files
authored
bpo-40280: Emscripten has no support for subprocesses (GH-29872)
Fixes ``platform`` and ``help()`` on emscripten. Signed-off-by: Christian Heimes <[email protected]> Automerge-Triggered-By: GH:tiran
1 parent 226d22f commit cb2b3c8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Lib/platform.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,10 @@ def _syscmd_file(target, default=''):
607607
# XXX Others too ?
608608
return default
609609

610-
import subprocess
610+
try:
611+
import subprocess
612+
except ImportError:
613+
return default
611614
target = _follow_symlinks(target)
612615
# "file" output is locale dependent: force the usage of the C locale
613616
# to get deterministic behavior.
@@ -746,7 +749,10 @@ def from_subprocess():
746749
"""
747750
Fall back to `uname -p`
748751
"""
749-
import subprocess
752+
try:
753+
import subprocess
754+
except ImportError:
755+
return None
750756
try:
751757
return subprocess.check_output(
752758
['uname', '-p'],

Lib/pydoc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,8 @@ def getpager():
15561556
return plainpager
15571557
if not sys.stdin.isatty() or not sys.stdout.isatty():
15581558
return plainpager
1559+
if sys.platform == "emscripten":
1560+
return plainpager
15591561
use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')
15601562
if use_pager:
15611563
if sys.platform == 'win32': # pipes completely broken in Windows

0 commit comments

Comments
 (0)