From: Xavier de Gaye Date: Tue, 13 Dec 2016 15:32:21 +0000 (+0100) Subject: Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, X-Git-Tag: v3.7.0a1~1761 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b35fc626c1efe72cf5a0b3c8faf860830aab0a83;p=thirdparty%2FPython%2Fcpython.git Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. --- diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c40f0179eef9..809e59f5eb7d 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1204,7 +1204,10 @@ class Popen(object): args = list(args) if shell: - args = ["/bin/sh", "-c"] + args + # On Android the default shell is at '/system/bin/sh'. + unix_shell = ('/system/bin/sh' if + hasattr(sys, 'getandroidapilevel') else '/bin/sh') + args = [unix_shell, "-c"] + args if executable: args[0] = executable diff --git a/Misc/NEWS b/Misc/NEWS index fe9dc9589080..a06e3cb788e2 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -177,6 +177,9 @@ Core and Builtins Library ------- +- Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, + instead of /bin/sh. + - Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks.