Skip to content

Commit

Permalink
fix: attach container stdin on tutor dev start <service> (#1152)
Browse files Browse the repository at this point in the history
This fixes breakpoint bugging as it is currently
described in the docs.
  • Loading branch information
Danyal-Faheem authored Dec 10, 2024
1 parent dd731c0 commit b662e9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Bugfix] Fix breakpoint debugging by attaching container stdin when running tutor dev start <service> for a single service. (by @Danyal-Faheem)
2 changes: 2 additions & 0 deletions docs/tutorials/edx-platform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ To debug a local edx-platform repository, first, start development in detached m
# Or, debugging CMS:
tutor dev start cms

To detach from the service without shutting it down, use ``Ctrl+p`` followed with ``Ctrl+q``.

Running edx-platform unit tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
13 changes: 12 additions & 1 deletion tutor/commands/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,26 @@ def start(
services: list[str],
) -> None:
command = ["up", "--remove-orphans"]
attach = len(services) == 1 and not detach
if build:
command.append("--build")
if detach:
# We have to run the container in detached mode first to attach to it
if detach or attach:
command.append("-d")
else:
fmt.echo_info("ℹ️ To exit logs without stopping the containers, use ctrl+z")

# Start services
config = tutor_config.load(context.root)
context.job_runner(config).docker_compose(*command, *services)

if attach:
fmt.echo_info(
f"""Attaching to service {services[0]}
ℹ️ To detach without stopping the service, use ctrl+p followed by ctrl+q"""
)
context.job_runner(config).docker_compose("attach", *services)


@click.command(help="Stop a running platform")
@click.argument("services", metavar="service", nargs=-1)
Expand Down

0 comments on commit b662e9e

Please sign in to comment.