pexpect / ptyprocess

Run a subprocess in a pseudo terminal
https://ptyprocess.readthedocs.io/en/latest/
Other
222 stars 71 forks source link

Added screen size parameters. #11

Closed detly closed 9 years ago

detly commented 9 years ago

I found myself wanting to set the size of the pty as seen by the subprocess (really for pexpect.spawn, but this is needed first). In some situations it can make parsing/interaction a lot easier.

Happy to change any stylistic things, eg.

  1. The dimensions=(24, 80) default arg could also be dimensions=None with some if dimensions is not None logic in spawn().
  2. It could be r=24, c=80 instead, but does it make sense to only have one dimension with a default? (Maybe, I don't know.)

I meant to add a test, but couldn't figure out a simple enough way to test this (eg. if there was a reliable command to check console size it could be like the other spawn tests, but I don't know of one).

takluyver commented 9 years ago

Seems fine, thanks. I thought about asking for rows and cols for symmetry with setwinsize(), but I agree with you that it would be bizarre to set one without the other.

detly commented 9 years ago

Heh, I hadn't thought about that inconsistency actually. Well, I'll leave it up to you; sometimes consistency is worth it, sometimes no one will mind :) On 17/03/2015 7:50 AM, "Thomas Kluyver" notifications@github.com wrote:

Seems fine, thanks. I thought about asking for rows and cols for symmetry with setwinsize(), but I agree with you that it would be bizarre to set one without the other.

— Reply to this email directly or view it on GitHub https://github.com/pexpect/ptyprocess/pull/11#issuecomment-81929499.

detly commented 9 years ago

I can make that change. On 17/03/2015 7:53 AM, "Jason Heeris" jason.heeris@gmail.com wrote:

Heh, I hadn't thought about that inconsistency actually. Well, I'll leave it up to you; sometimes consistency is worth it, sometimes no one will mind :) On 17/03/2015 7:50 AM, "Thomas Kluyver" notifications@github.com wrote:

Seems fine, thanks. I thought about asking for rows and cols for symmetry with setwinsize(), but I agree with you that it would be bizarre to set one without the other.

— Reply to this email directly or view it on GitHub https://github.com/pexpect/ptyprocess/pull/11#issuecomment-81929499.

jquast commented 9 years ago

+1

takluyver commented 9 years ago

Thanks!