Re: Wrapping A Shell




Jeremy Moles wrote:
I'm not sure if this is really the right place to ask this question, but
since the implementation is in Python, I figured I'd give it a shot.

I want to "wrap" a shell process using popen inside of python program
rather than creating a new shell process for each line I process in the
app. For example, the code might look like:


std = stdin, stdout, stderr = os.popen3("bash")

print >> stdin, "ls"

print stdout.readline()

However, it appears my understanding of popen (or perhaps buffered IO)
is off somewhere, because this certainly doesn't work anything like I
expect it to (it hangs on stdout.readline).

Obviously the example above is very contrived, but eventually I'll be
using this in an OpenGL "terminal" widget. Am I approaching this the
wrong way?

Try flushing the bufffer for stdin.


Cheers,
-T

.



Relevant Pages

  • Re: Wrapping A Shell
    ... I want to "wrap" a shell process using popen inside of python program ... Here is a possible way to solve the problems with subprocess (unix ... only) and non blocking IO. ...
    (comp.lang.python)
  • Wrapping A Shell
    ... I want to "wrap" a shell process using popen inside of python program ... expect it to (it hangs on stdout.readline). ... using this in an OpenGL "terminal" widget. ...
    (comp.lang.python)
  • Re: How to make VB wait until Shell process is finished
    ... > to write a GUI front-end to wrap around that C program and process the ... > How do I make a VB program stop and wait for a shell process to ... > (please post to group since my email is saturated with spam). ...
    (microsoft.public.vb.general.discussion)