Re: Reassign or discard Popen().stdout from a server process

2011-02-11 Thread John O'Hagan
On Fri, 11 Feb 2011, Nobody wrote: > On Thu, 10 Feb 2011 08:35:24 +, John O'Hagan wrote: > >> > But I'm still a little curious as to why even unsuccessfully > >> > attempting to reassign stdout seems to stop the pipe buffer from > >> > filling up. > >> > >> It doesn't. If the server continues

Re: Reassign or discard Popen().stdout from a server process

2011-02-11 Thread Nobody
On Thu, 10 Feb 2011 08:35:24 +, John O'Hagan wrote: >> > But I'm still a little curious as to why even unsuccessfully attempting >> > to reassign stdout seems to stop the pipe buffer from filling up. >> >> It doesn't. If the server continues to run, then it's ignoring/handling >> both SIGPIPE

Re: Reassign or discard Popen().stdout from a server process

2011-02-10 Thread John O'Hagan
On Wed, 9 Feb 2011, Nobody wrote: > On Fri, 04 Feb 2011 15:48:55 +, John O'Hagan wrote: > > But I'm still a little curious as to why even unsuccessfully attempting > > to reassign stdout seems to stop the pipe buffer from filling up. > > It doesn't. If the server continues to run, then it's ig

Re: Reassign or discard Popen().stdout from a server process

2011-02-08 Thread Nobody
On Fri, 04 Feb 2011 15:48:55 +, John O'Hagan wrote: > But I'm still a little curious as to why even unsuccessfully attempting to > reassign stdout seems to stop the pipe buffer from filling up. It doesn't. If the server continues to run, then it's ignoring/handling both SIGPIPE and the EPIPE

Re: Reassign or discard Popen().stdout from a server process

2011-02-04 Thread John O'Hagan
On Thu, 3 Feb 2011, Nobody wrote: > On Tue, 01 Feb 2011 08:30:19 +, John O'Hagan wrote: > > I can't keep reading because that will block - there won't be any more > > output until I send some input, and I don't want it in any case. > > > > To try to fix this I added: > > > > proc.stdout = os.

Re: Reassign or discard Popen().stdout from a server process

2011-02-03 Thread Nobody
On Tue, 01 Feb 2011 08:30:19 +, John O'Hagan wrote: > I can't keep reading because that will block - there won't be any more > output until I send some input, and I don't want it in any case. > > To try to fix this I added: > > proc.stdout = os.path.devnull > > which has the effect of stopp

Re: Reassign or discard Popen().stdout from a server process

2011-02-01 Thread John O'Hagan
On Tue, 1 Feb 2011, John O'Hagan wrote: > > So far my best bet seems to be closing stdin, which doesn't seem very > clean, but it does what I want and seems to be just as fast as using > stdin=open(os.devnull) in the Popen call in the first place. ...and both references to stdin above should hav

Re: Reassign or discard Popen().stdout from a server process

2011-02-01 Thread John O'Hagan
On Tue, 1 Feb 2011, Chris Rebert wrote: > On Tue, Feb 1, 2011 at 12:30 AM, John O'Hagan wrote: > > I'm starting a server process as a subprocess. Startup is slow and > > unpredictable (around 3-10 sec), so I'm reading from its stdout until I > > get a line that tells me it's ready before proceedin

Re: Reassign or discard Popen().stdout from a server process

2011-02-01 Thread Chris Rebert
On Tue, Feb 1, 2011 at 12:30 AM, John O'Hagan wrote: > I'm starting a server process as a subprocess. Startup is slow and > unpredictable (around 3-10 sec), so I'm reading from its stdout until I get a > line that tells me it's ready before proceeding, in simplified form: > > import subprocess > p

Reassign or discard Popen().stdout from a server process

2011-02-01 Thread John O'Hagan
I'm starting a server process as a subprocess. Startup is slow and unpredictable (around 3-10 sec), so I'm reading from its stdout until I get a line that tells me it's ready before proceeding, in simplified form: import subprocess proc = subprocess.Popen(['server', 'args'], stdout=subprocess.PI