Merge pull request #3436 from shin-/3374-exec-windows

Fail gracefully when -d is not provided for exec command on Win32
This commit is contained in:
Joffrey F 2016-05-12 15:14:15 -07:00
commit ca3aef0c84
1 changed files with 8 additions and 1 deletions

View File

@ -334,6 +334,13 @@ class TopLevelCommand(object):
"""
index = int(options.get('--index'))
service = self.project.get_service(options['SERVICE'])
detach = options['-d']
if IS_WINDOWS_PLATFORM and not detach:
raise UserError(
"Interactive mode is not yet supported on Windows.\n"
"Please pass the -d flag when using `docker-compose exec`."
)
try:
container = service.get_container(number=index)
except ValueError as e:
@ -350,7 +357,7 @@ class TopLevelCommand(object):
exec_id = container.create_exec(command, **create_exec_options)
if options['-d']:
if detach:
container.start_exec(exec_id, tty=tty)
return