Add a once exec ... command#75
Merged
Merged
Conversation
Adds a new CLI command, `exec` which executes a command in an application's running container. Much like `docker exec`, `docker compose exec`, etc. - Will attach a TTY as necessary, so interactive commands work without additional flags - Passes back the exit code from the command
There was a problem hiding this comment.
Pull request overview
Adds a new once exec CLI command that executes a command inside a running application container (similar to docker exec), including TTY attachment/resize handling and propagating the container command’s exit status back to the once process.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Changes:
- Implement attached exec support in the Docker layer (TTY/raw mode, stdin/stdout piping, resize handling, exit-code errors).
- Add
once exec <host> <command> [args...]command wiring plus argument parsing and unit tests. - Propagate exec exit codes through the CLI entrypoint and add integration coverage for success/failure/not-running cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/docker/container.go | Adds attached exec implementation (TTY detection, raw mode, I/O piping, resize monitoring) and exit-code error type. |
| internal/docker/application.go | Exposes Application.Exec and maps Docker “conflict” errors to ErrApplicationNotRunning. |
| internal/command/root.go | Registers the new exec subcommand and adds helpers for extracting exit codes from errors. |
| internal/command/exec.go | Implements the once exec Cobra command and argument splitting (including -- separator). |
| internal/command/exec_test.go | Unit tests for splitExecArgs behavior. |
| integration/docker_test.go | Integration tests validating exec exit codes and behavior when the app is stopped. |
| cmd/once/main.go | Exits with the underlying exec exit code when present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new CLI command,
execwhich executes a command in an application's running container. Much likedocker exec,docker compose exec, etc.Closes #59