How to read the first line of a subprocess without buffers filling up in Python
Question: From Python in Linux, I want to start a sub-process, wait until it prints one
line on it's standard out, then continue with the rest of my Python script. If
I do:

    
    
    from subprocess import *
    
    proc = Popen(my_process, stdout=PIPE)
    proc.readline()
    
    # Now continue with the rest of my script
    

Will my process eventually block if it writes a lot to its stdout, because the
pipe fills up?

Ideally, I'd like the rest of the output to go to the standard output of my
script. Is there a way to change the stdout of the subprocess from PIPE to my
standard output after it starts?

I'm guessing I'll have to spawn a separate thread just to read from my
process's stdout and print to my own, but I'd like to avoid that if there's a
simpler solution.


Answer: Stop the process?

    
    
    proc.terminate()
    

After the readline

