summaryrefslogtreecommitdiff
path: root/docker/utils/utils.py
diff options
context:
space:
mode:
authorDaniel Nephin <dnephin@gmail.com>2015-10-26 17:12:29 -0400
committerDaniel Nephin <dnephin@gmail.com>2015-10-26 17:22:14 -0400
commit417c80057bed70a4e6a39c3f04c13615b4300f52 (patch)
tree54c493b96585584a5ae3c60cf962a75a2608761c /docker/utils/utils.py
parent0234ddebf30b2c979d0fb75ea72280e4f35fec35 (diff)
downloaddocker-py-417c80057bed70a4e6a39c3f04c13615b4300f52.tar.gz
Support unicode commands.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
Diffstat (limited to 'docker/utils/utils.py')
-rw-r--r--docker/utils/utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index 89837b7..4d2968a 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -673,6 +673,12 @@ def parse_env_file(env_file):
return environment
+def split_command(command):
+ if six.PY2:
+ command = command.encode('utf-8')
+ return shlex.split(command)
+
+
def create_container_config(
version, image, command, hostname=None, user=None, detach=False,
stdin_open=False, tty=False, mem_limit=None, ports=None, environment=None,
@@ -682,10 +688,10 @@ def create_container_config(
labels=None, volume_driver=None
):
if isinstance(command, six.string_types):
- command = shlex.split(str(command))
+ command = split_command(command)
if isinstance(entrypoint, six.string_types):
- entrypoint = shlex.split(str(entrypoint))
+ entrypoint = split_command(entrypoint)
if isinstance(environment, dict):
environment = [