Giter Club home page Giter Club logo

Comments (6)

deliciouslytyped avatar deliciouslytyped commented on May 25, 2024

I took a run at it with the debugger and it seems to hang in

self.process.wait()

from libtmux.

deliciouslytyped avatar deliciouslytyped commented on May 25, 2024

Is this possibly the problem? https://stackoverflow.com/questions/1445627/how-can-i-find-out-why-subprocess-popen-wait-waits-forever-if-stdout-pipe

Some more stuff https://stackoverflow.com/questions/30982217/python-popen-wait-vs-communicate-vs-calledprocesserror

from libtmux.

deliciouslytyped avatar deliciouslytyped commented on May 25, 2024

The following patch appears to work

diff --git a/libtmux/common.py b/libtmux/common.py
index 9681d3e..64f4313 100644
--- a/libtmux/common.py
+++ b/libtmux/common.py
@@ -205,11 +205,7 @@ class tmux_cmd(object):
             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))

from libtmux.

gil-obradors avatar gil-obradors commented on May 25, 2024

I have the same problem, reading a history of 1800 lines with buffer.

I will test for a days, and I will create a PR

Seems to work , justified improvement

from libtmux.

tony avatar tony commented on May 25, 2024

Merged #297. Fix is in 0.8.5

https://libtmux.git-pull.com/history.html#libtmux-0-8-5-2020-10-25

pip install --user -U libtmux

Better now?

@gil-obradors @deliciouslytyped

(assuming you are still using libtmux, @deliciouslytyped, I apologize for the delay!)

from libtmux.

gil-obradors avatar gil-obradors commented on May 25, 2024

Many thanks @tony !

from libtmux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.