mirror of https://github.com/docker/compose.git
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:
commit
ca3aef0c84
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue