diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 76c340c87970aa..3342550e8f3156 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -47,6 +47,7 @@ import io import os import time +import shlex import signal import builtins import warnings @@ -1209,7 +1210,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, # 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 + cmdline = " ".join(shlex.quote(x) for x in args) + args = [unix_shell, "-c", cmdline] if executable: args[0] = executable