Merge pull request #5456 from docker/5442-find_executable_utf_err

Recover from possible unicode errors in get_conn_error_message
This commit is contained in:
Joffrey F 2017-12-07 17:20:19 -08:00 committed by GitHub
commit a28610022b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 7 deletions

View File

@ -106,7 +106,8 @@ def log_api_error(e, client_version):
log.error( log.error(
"The Docker Engine version is less than the minimum required by " "The Docker Engine version is less than the minimum required by "
"Compose. Your current project requires a Docker Engine of " "Compose. Your current project requires a Docker Engine of "
"version {version} or greater.".format(version=version)) "version {version} or greater.".format(version=version)
)
def exit_with_error(msg): def exit_with_error(msg):
@ -115,12 +116,17 @@ def exit_with_error(msg):
def get_conn_error_message(url): def get_conn_error_message(url):
if find_executable('docker') is None: try:
return docker_not_found_msg("Couldn't connect to Docker daemon.") if find_executable('docker') is None:
if is_docker_for_mac_installed(): return docker_not_found_msg("Couldn't connect to Docker daemon.")
return conn_error_docker_for_mac if is_docker_for_mac_installed():
if find_executable('docker-machine') is not None: return conn_error_docker_for_mac
return conn_error_docker_machine if find_executable('docker-machine') is not None:
return conn_error_docker_machine
except UnicodeDecodeError:
# https://github.com/docker/compose/issues/5442
# Ignore the error and print the generic message instead.
pass
return conn_error_generic.format(url=url) return conn_error_generic.format(url=url)