New line conversion with Popen attached to a pty

jfharden at gmail.com jfharden at gmail.com
Fri Jun 21 07:12:32 EDT 2013


On Thursday, 20 June 2013 23:04:39 UTC+1, Peter Otten  wrote:

> (2) Fiddle with terminal options, e. g.
> 
>     attrs = termios.tcgetattr(outSlave)
>     attrs[1]  =  attrs[1] & (~termios.ONLCR) | termios.ONLRET
>     termios.tcsetattr(outSlave, termios.TCSANOW, attrs)
> 
>     p = subprocess.Popen(
>         ("/bin/cat", "output.txt"),
>         stdout=outSlave,
>     )
>
> Disclaimer: I found this by try-and-error, so it may not be the "proper" 
> way.

Thank you! That is absolutely perfect. I had read about pty options but didn't think to read about tty options. If we ever meet in real life remind me to buy you a beverage of your choosing.



More information about the Python-list mailing list