[Python-checkins] cpython: Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell,

xavier.degaye python-checkins at python.org
Tue Dec 13 10:32:58 EST 2016


https://hg.python.org/cpython/rev/96a9992d1003
changeset:   105608:96a9992d1003
user:        Xavier de Gaye <xdegaye at users.sourceforge.net>
date:        Tue Dec 13 16:32:21 2016 +0100
summary:
  Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell,
instead of /bin/sh.

files:
  Lib/subprocess.py |  5 ++++-
  Misc/NEWS         |  3 +++
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1204,7 +1204,10 @@
                 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -177,6 +177,9 @@
 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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list