Skip to content

feat: Add ResizeExecTtyAsync to IExecOperations#68

Open
j4587698 wants to merge 2 commits intotestcontainers:mainfrom
j4587698:feat/exec-resize
Open

feat: Add ResizeExecTtyAsync to IExecOperations#68
j4587698 wants to merge 2 commits intotestcontainers:mainfrom
j4587698:feat/exec-resize

Conversation

@j4587698
Copy link

Summary
Added the missing ResizeExecTtyAsync method to IExecOperations, which maps to POST /exec/{id}/resize in the Docker Engine API. This allows resizing the TTY of a running exec instance — essential for interactive terminal sessions (e.g., docker exec -it).
Changes

  • Added ResizeExecTtyAsync(string id, ContainerResizeParameters parameters, CancellationToken) to IExecOperations interface.
  • Implemented in ExecOperations using MakeRequestAsync with query string parameters (h and w), consistent with the existing ResizeContainerTtyAsync in ContainerOperations.
  • Added 2 integration tests:
    • ResizeExecTtyAsync_RunningExec_Succeeds — creates a container, starts a TTY exec, resizes, and verifies the exec is still running.
    • ResizeExecTtyAsync_NonExistentExecId_ThrowsException — verifies DockerContainerNotFoundException for invalid exec IDs.

Add the missing exec TTY resize API (POST /exec/{id}/resize) to
IExecOperations and ExecOperations, mirroring the existing
ResizeContainerTtyAsync in ContainerOperations.

Docker Engine API supports resizing exec instances via
POST /exec/{id}/resize?h={height}&w={width}, but this endpoint
was not exposed in the SDK. This makes it impossible to properly
resize terminal sessions created via exec without resorting to
raw HTTP requests or workarounds like stty commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant