Skip to content

Commit

Permalink
added workaround for #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTimperley committed Oct 19, 2019
1 parent 05c61e8 commit 8990bef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dockerblade/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,25 @@ def run(self,
A summary of the outcome of the command execution.
"""
logger.debug(f"executing command: {args}")
no_output = not stdout and not stderr
docker_container = self.container._docker
args_instrumented = self._instrument(args)

with Stopwatch() as timer:
retcode, output_bin = docker_container.exec_run(
args_instrumented,
detach=False,
stderr=stderr,
stdout=stdout,
tty=True,
stream=False,
socket=False,
stderr=False if no_output else stderr, # BUG #25
stdout=True if no_output else stdout, # BUG #25
workdir=cwd)

logger.debug(f"retcode: {retcode}")

output: Optional[Union[str, bytes]]
if not stdout and not stderr:
if no_output:
output = None
elif text:
output = output_bin.decode(encoding).rstrip('\r\n')
Expand Down

0 comments on commit 8990bef

Please sign in to comment.