Skip to content

Better interaction with subprocess std[in|out|err] #297

New issue

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

Merged
merged 4 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Here you can find the recent changes to libtmux

current
-------
- :issue:`251`: Enchance subprocess interaction std[in|out|err]. Needed
for interact with big buffer
- :issue:`303` Add ``common.get_libtmux_version`` which gives the tmux
version as a loose constraint. Fix linking to terms inside docs, and
duplicate description of module which sphinx warned about in api.rst.
Expand Down
6 changes: 1 addition & 5 deletions libtmux/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ def __init__(self, *args, **kwargs):
self.process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
self.process.wait()
stdout = self.process.stdout.read()
self.process.stdout.close()
stderr = self.process.stderr.read()
self.process.stderr.close()
stdout, stderr = self.process.communicate()
returncode = self.process.returncode
except Exception as e:
logger.error('Exception for %s: \n%s' % (subprocess.list2cmdline(cmd), e))
Expand Down