We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exec_run
demux=True
None
bytes
When calling exec_run with demux=True, the documentation states that a pair of bytes is returned.
However, if no standard output (or no standard error) is produced, then the corresponding tuple entry is None instead of an empty bytes (b'').
b''
Minimum working example:
import docker client = docker.from_env() container = client.containers.run("alpine:latest", detach=True, tty=True) container.exec_run(("sh", "-c", "echo out >&1"), demux=True) # ExecResult(exit_code=0, output=(b'out\n', None)) container.exec_run(("sh", "-c", "echo err >&2"), demux=True) # ExecResult(exit_code=0, output=(None, b'err\n'))
The expected behaviour is that both tuple entries are always bytes. Alternatively, the possibility of returning None should be documented clearly!
The text was updated successfully, but these errors were encountered:
Yes, I checked that in documentation here and it seems very easily solvable as below:
+ exec_output = tuple(b'' if x is None else x for x in exec_output)
Sorry, something went wrong.
fix: none output type in exec_run(docker#3172)
afc73d1
3df4b6e
Signed-off-by: Khushiyant <[email protected]>
Successfully merging a pull request may close this issue.
When calling
exec_run
withdemux=True
, the documentation states that a pair ofbytes
is returned.However, if no standard output (or no standard error) is produced, then the corresponding tuple entry is
None
instead of an emptybytes
(b''
).Minimum working example:
The expected behaviour is that both tuple entries are always
bytes
. Alternatively, the possibility of returningNone
should be documented clearly!The text was updated successfully, but these errors were encountered: