changeset: 105608:96a9992d1003 user: Xavier de Gaye date: Tue Dec 13 16:32:21 2016 +0100 files: Lib/subprocess.py Misc/NEWS description: Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. diff -r bdf92b4e02f2 -r 96a9992d1003 Lib/subprocess.py --- a/Lib/subprocess.py Tue Dec 13 16:05:15 2016 +0100 +++ b/Lib/subprocess.py Tue Dec 13 16:32:21 2016 +0100 @@ -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 -r bdf92b4e02f2 -r 96a9992d1003 Misc/NEWS --- a/Misc/NEWS Tue Dec 13 16:05:15 2016 +0100 +++ b/Misc/NEWS Tue Dec 13 16:32:21 2016 +0100 @@ -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.