Skip to content

Commit

Permalink
Merge pull request #204 from python-cmd2/pipe_simplify
Browse files Browse the repository at this point in the history
The default buffer size is fine for 99% of pipe operations
  • Loading branch information
tleonhardt committed Aug 10, 2017
2 parents b319900 + 3db44e5 commit bdd06fb
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,6 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, use_ipython=False
# Used when piping command output to a shell command
self.pipe_proc = None

# Size of the stdin/stdout buffers used when piping command output to a shell command via self.stdout.
# This should be increased in cases where large amounts of data are expected to be piped to the shell
# to prevent blocking when writing to self.stdout.
self._pipe_buffer_size = io.DEFAULT_BUFFER_SIZE

# ----- Methods related to presenting output to the user -----

@property
Expand Down Expand Up @@ -816,9 +811,9 @@ def _redirect_output(self, statement):

# Open each side of the pipe and set stdout accordingly
# noinspection PyTypeChecker
self.stdout = io.open(write_fd, write_mode, buffering=self._pipe_buffer_size)
self.stdout = io.open(write_fd, write_mode)
# noinspection PyTypeChecker
subproc_stdin = io.open(read_fd, read_mode, buffering=self._pipe_buffer_size)
subproc_stdin = io.open(read_fd, read_mode)

# We want Popen to raise an exception if it fails to open the process. Thus we don't set shell to True.
try:
Expand Down

0 comments on commit bdd06fb

Please sign in to comment.