Re: How can I know how much to read from a subprocess

2007-09-19 Thread A.T.Hofkamp
On 2007-09-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > It seems that another solution is gobject.io_add_watch, but I don't >> > see how it tells me how much I c

Re: How can I know how much to read from a subprocess

2007-09-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > ... how can I know if the process wrote something to its > output, and how much it wrote? Others have mentioned using one-byte reads. To tell if something is available for reading, use select

Re: How can I know how much to read from a subprocess

2007-09-18 Thread Karthik Gurusamy
On Sep 17, 4:14 pm, [EMAIL PROTECTED] wrote: > Hello, > > I want to write a terminal program in pygtk. It will run a subprocess, > display everything it writes in its standard output and standard > error, and let the user write text into its standard input. > > The question is, how can I know if th

Re: How can I know how much to read from a subprocess

2007-09-18 Thread Grant Edwards
On 2007-09-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > But even if it's fast enough, how do you know how many times you > should call read(1)? If you do it too much, you'll be blocked until > more output is available. You don't know. That's why you use non-blocking mode. -- Grant Edward

Re: How can I know how much to read from a subprocess

2007-09-18 Thread spam . noam
On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > It seems that another solution is gobject.io_add_watch, but I don't > > see how it tells me how much I can read from the file - if I don't > > know that, I won't know the

Re: How can I know how much to read from a subprocess

2007-09-18 Thread A.T.Hofkamp
On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It seems that another solution is gobject.io_add_watch, but I don't > see how it tells me how much I can read from the file - if I don't > know that, I won't know the argument to give to the read() method in > order to get all the data:

Re: How can I know how much to read from a subprocess

2007-09-17 Thread spam . noam
Ok, I could have researched this before posting, but here's an explanation how to do it with twisted: http://unpythonic.blogspot.com/2007/08/spawning-subprocess-with-pygtk-using.html It seems that another solution is gobject.io_add_watch, but I don't see how it tells me how much I can read from t

How can I know how much to read from a subprocess

2007-09-17 Thread spam . noam
Hello, I want to write a terminal program in pygtk. It will run a subprocess, display everything it writes in its standard output and standard error, and let the user write text into its standard input. The question is, how can I know if the process wrote something to its output, and how much it