Launching a process with stdout in the terminal and captured

Olive diolu.remove_this_part at bigfoot.com
Sat Jun 18 03:09:44 EDT 2016


I am here on Linux. I want to launch a process just like os.system, (output to a terminal in an unbuffered way so as to support interaction) and at the same time capturing the output of the process (analogous to the Unix tee command). I have found some tricks on the web, but is it a standard way to do that? Note that if it is possible I would prefer that the launched command see its standard output connected to a terminal (many command change their behaviour accordingly like 'ls', etc.). 

The main reason now is to run latex (with its interaction), I need the output to know where it has put its output {dvi,pdf} file (you can't guess it from the command line because you can launch latex without any argument and \input a file afterwards). 

Olivier




More information about the Python-list mailing list