docker / docker/docker-py

exec_run() should return a function to return the exit code, when stream=True

Open
#2,557 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

Currently, container.exec_run() returns an exit code of None if socket=True or stream=True.
This is presumably because at the point that the (rc, output_generator) tuplet is returned, the exit code is not yet known.
It is, however, very annoying, as the use case of "continuously update reporting of output" is one in which knowing the return code is usually also necessary.
However, this is trivially solvable by returning a lambda function in this case:

dockerdiff.txt

This allows the caller to postpone evaluating rc() until after the output_generator has raised StopIteration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the container.exec_run() entry point and review the proposed dockerdiff.txt change. Confirm how stream=True and socket=True currently expose the exit code, then make completion expose the final code after output_generator is exhausted; done means callers can retrieve that code reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.