exec_run
with demux=True
: output is None
instead of empty bytes
#3172
Open
Description
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''
).
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!
Metadata
Assignees
Labels
No labels