mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
Fail gracefully when -d is not provided for exec command on Win32
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
c9fe8920c9
commit
e5645595e3
@ -334,6 +334,13 @@ class TopLevelCommand(object):
|
|||||||
"""
|
"""
|
||||||
index = int(options.get('--index'))
|
index = int(options.get('--index'))
|
||||||
service = self.project.get_service(options['SERVICE'])
|
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:
|
try:
|
||||||
container = service.get_container(number=index)
|
container = service.get_container(number=index)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -350,7 +357,7 @@ class TopLevelCommand(object):
|
|||||||
|
|
||||||
exec_id = container.create_exec(command, **create_exec_options)
|
exec_id = container.create_exec(command, **create_exec_options)
|
||||||
|
|
||||||
if options['-d']:
|
if detach:
|
||||||
container.start_exec(exec_id, tty=tty)
|
container.start_exec(exec_id, tty=tty)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user