bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ]#21752
bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ]#217528vasu wants to merge 4 commits into
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
Sorry, something went wrong.
|
The following are two [ very old ] stackoverflow threads that are relevant. https://stackoverflow.com/questions/6418678/resize-the-terminal-with-python |
Sorry, something went wrong.
|
Added detailed comments to the diff. |
Sorry, something went wrong.
This was tested using Python 3.7 after commenting out the sys.audit lines.
https://docs.python.org/3/library/pty.html presents us with an example usage of pty.spawn. This example mimics script(1). However, the script(1) from util-linux has fantastic signal handing that pty.spawn does not directly provide. In fact, Lib/pty.py says "Bugs: No signal handling. Doesn't set slave termios and window size."
xterm(1) on Debian 10 GNU/Linux was used to test the pty.spawn example mentioned above; upon resizing the xterm(1) window, the output of programs such as ls(1) became scattered and hard to visually parse.
Currently, this patch does not modify any of the functions that are already present in Lib/pty.py. Instead, it exposes a new function called "wspawn" [ pty.wspawn ]. This is like pty.spawn + the following differences.
The aforementioned pty.spawn example now works well with window resizing if pty.wspawn is used in place of pty.spawn.
Signed-off-by: Soumendra Ganguly soumendraganguly@gmail.com
https://bugs.python.org/issue41494