Help to debug my free library

Victor Porton porton at narod.ru
Wed Jan 31 14:26:29 EST 2018


Chris Angelico wrote:

> On Thu, Feb 1, 2018 at 5:58 AM, Victor Porton <porton at narod.ru> wrote:
>> LibComCom is a C library which passes a string as stdin of an OS command
>> and stores its stdout in another string.
> 
> Something like the built-in subprocess module does?

I was going to write: "It seems that subprocess module can cause deadlocks. 
For example, if it first writes a long string to "cat" command input (going 
to read cat's stdout later), then "cat" would block because its output is 
not read while writing input."

But after reading the docs it seems that Popen.communicate() does the job.

Well, I first wrote in Java. For Java there was no ready solution. Later I 
switched to Python and haven't checked the standard libraries.

So, please help me to make sure if Popen.communicate() is a solution for my 
problem (namely that it does not deadlock, as in "cat" example above).

I am interested in both Python 2.7 and 3.x.

> ChrisA

-- 
Victor Porton - http://portonvictor.org



More information about the Python-list mailing list