popen help

J

Jason Zheng

I'm trying to open a subshell to run some csh commands, and I want to
connect the stdout of the subshell to the main stdout:

sub = Popen4('csh -f')
sub.tochild.write('source source.me\n')
sub.tochild.write('runthis\n')
sub.tochild.close()

for x in sub.fromchild.readlines():
print x

The way I have it can only display everything after the execution of the
commands that I send to the subshell. Is there a way to display the
output as the subshell execute those commands?

Thanks in advance,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top