Output ignored after last newline character
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
Hello, it seems that any output from the container after the last newline character is ignored; for instance, if I run:
import docker
client = docker.from_env()
hello_world = client.containers.run('alpine',
'echo Hello world', # Ends with a newline
auto_remove=True)
print(hello_world)
hello_again = client.containers.run('alpine',
'echo -n Hello again', # Doesn't end with a newline
auto_remove=True)
print(hello_again)
Then the output is:
b'Hello world\n'
b''
It seems to be a bug, especially since in the first case, the newline is included in the output; can you please look into it?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named in the issue. Start by reproducing the two client.containers.run examples with echo Hello world and echo -n Hello again, then trace the container output path. Done means output is returned consistently whether or not it ends with a newline, with regression coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100