Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48859

Re: New line conversion with Popen attached to a pty

Newsgroups comp.lang.python
Date 2013-06-21 04:12 -0700
References <c280b727-f979-4107-89e8-a4a54be2fbfa@googlegroups.com> <mailman.3640.1371765829.3114.python-list@python.org>
Message-ID <36d7783e-92b9-4c02-ae23-7c42fdbca4cd@googlegroups.com> (permalink)
Subject Re: New line conversion with Popen attached to a pty
From jfharden@gmail.com

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

New line conversion with Popen attached to a pty jfharden@gmail.com - 2013-06-20 06:28 -0700
  Re: New line conversion with Popen attached to a pty Peter Otten <__peter__@web.de> - 2013-06-21 00:04 +0200
    Re: New line conversion with Popen attached to a pty jfharden@gmail.com - 2013-06-21 04:12 -0700

csiph-web