Adds window resizing support to Lib/pty.py [ SIGWINCH ] #85666
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 41494 |
|---|---|
| Nosy | @ambv, @8vasu |
| PRs | |
| Superseder | |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2021-08-11.14:26:18.624>
created_at = <Date 2020-08-06.11:10:23.164>
labels = ['3.7', '3.8', '3.9', '3.10', 'type-feature', 'library']
title = 'Adds window resizing support to Lib/pty.py [ SIGWINCH ]'
updated_at = <Date 2021-08-11.14:26:18.623>
user = 'https://github.com/8vasu'bugs.python.org fields:
activity = <Date 2021-08-11.14:26:18.623>
actor = 'lukasz.langa'
assignee = 'none'
closed = True
closed_date = <Date 2021-08-11.14:26:18.624>
closer = 'lukasz.langa'
components = ['Library (Lib)']
creation = <Date 2020-08-06.11:10:23.164>
creator = 'soumendra'
dependencies = []
files = ['49372', '49376']
hgrepos = []
issue_num = 41494
keywords = ['patch']
message_count = 7.0
messages = ['374926', '375025', '375044', '375086', '375314', '377196', '399395']
nosy_count = 2.0
nosy_names = ['lukasz.langa', 'soumendra']
pr_nums = ['21752']
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = '41818'
type = 'enhancement'
url = 'https://bugs.python.org/issue41494'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
8vasu commentedon Aug 6, 2020
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.
This patch does not modify any of the functions that are already present in Lib/pty. 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>
8vasu commentedon Aug 8, 2020
Updated diff.
Changes _ekill()
[-]Add window resizing support [ SIGWINCH ] to Lib/pty[/-][+]Adds window resizing support to Lib/pty.py for proper output rendering[/+]2 remaining items
[-]Adds window resizing support to Lib/pty.py for proper output rendering[/-][+]Adds window resizing support to Lib/pty.py[/+][-]Adds window resizing support to Lib/pty.py for proper output rendering[/-][+]Adds window resizing support to Lib/pty.py[/+][-]Adds window resizing support to Lib/pty.py[/-][+]Adds window resizing support to Lib/pty.py [ SIGWINCH ][/+][-]Adds window resizing support to Lib/pty.py[/-][+]Adds window resizing support to Lib/pty.py [ SIGWINCH ][/+]8vasu commentedon Aug 9, 2020
Possibly related issues:
https://bugs.python.org/issue29070
https://bugs.python.org/issue26228
Since wspawn does not depend on OSError, it might be a possible [ not necessarily the only way ] of solving the above issues.
8vasu commentedon Aug 13, 2020
Closing because registering SIGWINCH handler from within library function is impractical.
8vasu commentedon Sep 19, 2020
Reopening to indicate that this issue has not been resolved. However, this thread should not be used anymore. Use this instead: https://bugs.python.org/issue41818
ambv commentedon Aug 11, 2021
Thanks, Soumendra. Not resolved but superseded by a different issue has its own indicators on BPO.