From 658a638b6fe89aef5c8825410cbf3a7b0d08db80 Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Tue, 13 Dec 2016 16:32:21 +0100 Subject: Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. --- Lib/subprocess.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Lib/subprocess.py') diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c40f0179ee..809e59f5eb 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 -- cgit v1.2.1