René's URL Explorer Experiment


Title: bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ] by 8vasu · Pull Request #21752 · python/cpython · GitHub

Open Graph Title: bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ] by 8vasu · Pull Request #21752 · python/cpython

X Title: bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ] by 8vasu · Pull Request #21752 · python/cpython

Description: 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. Window size is set at the beginning. A SIGWINCH handler is registered. The old handler is saved and restored later. If the above two steps fail, then cleanup is done, and an exception is raised, so that the programmer can catch the exception and use pty.spawn instead. Unlike pty.spawn, this does not depend on OSError to break out of the parent mainloop. Instead, the main loop calls select with an adjustable timeout, so that waitpid with WNOHANG can be called periodically to check if the spawned child process has undergone an alteration of state. This might be a possible solution to https://bugs.python.org/issue26228, which is mentioned in the docs [ https://docs.python.org/3/library/pty.html ]. While the return value is same as that of pty.spawn, this accepts an extra optional "timeout" argument for the select call. 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

Open Graph Description: 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). ...

X Description: 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). ...

Opengraph URL: https://github.com/python/cpython/pull/21752

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:12a32462-3527-f07f-6edc-c222f09f395e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id8382:246776:686697:6BF7A5:6A51FFDA
html-safe-nonce53b8bfe8c2a0f67d8c714707e38c5f0201064c75bb4b4405b534c73b2581bf59
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzgyOjI0Njc3Njo2ODY2OTc6NkJGN0E1OjZBNTFGRkRBIiwidmlzaXRvcl9pZCI6Ijc3MjQ3NzIxNzg1NjcyMzM0OTgiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ==
visitor-hmacd4246096dd19d90ea02c14162d6a8f1fe56d38c986b8193abb9f8f437d45e0f6
hovercard-subject-tagpull_request:463980499
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/21752/files
twitter:imagehttps://avatars.githubusercontent.com/u/67527439?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/67527439?s=400&v=4
og:image:altThis 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). ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/21752/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F21752%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F21752%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/21752/files
Reloadhttps://github.com/python/cpython/pull/21752/files
Reloadhttps://github.com/python/cpython/pull/21752/files
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.7k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
8vasuhttps://github.com/8vasu
python:masterhttps://github.com/python/cpython/tree/master
8vasu:fix-issue-41494https://github.com/8vasu/cpython/tree/fix-issue-41494
Conversation 11 https://github.com/python/cpython/pull/21752
Commits 4 https://github.com/python/cpython/pull/21752/commits
Checks 0 https://github.com/python/cpython/pull/21752/checks
Files changed https://github.com/python/cpython/pull/21752/files
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
bpo-41494: Adds window resizing support to pty.spawn [ SIGWINCH ] https://github.com/python/cpython/pull/21752/files#top
Show all changes 4 commits https://github.com/python/cpython/pull/21752/files
d224e6a Add window resizing support [ SIGWINCH ] 8vasu Aug 6, 2020 https://github.com/python/cpython/pull/21752/commits/d224e6ab9c925bdc2dcbd2e6a01a7cee1877f75a
7220f13 📜🤖 Added by blurb_it. blurb-it[bot] Aug 7, 2020 https://github.com/python/cpython/pull/21752/commits/7220f139d57ab7c9c9a457222a2051d40a9f422a
92c8772 Modify _ekill() 8vasu Aug 8, 2020 https://github.com/python/cpython/pull/21752/commits/92c8772f8135145d495bd4a4ee29c729995fc9cb
bf2f1b2 Update 2020-08-07-08-47-08.bpo-41494.ql-kB9.rst 8vasu Aug 11, 2020 https://github.com/python/cpython/pull/21752/commits/bf2f1b2ddce04fafb50bdb0b48501379c9463f82
Clear filters https://github.com/python/cpython/pull/21752/files
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
pty.py https://github.com/python/cpython/pull/21752/files#diff-6951c8bf11da0d5912302a24b778e2c968fae9212bfeb2e73de06ec257b2d1da
2020-08-07-08-47-08.bpo-41494.ql-kB9.rst https://github.com/python/cpython/pull/21752/files#diff-8acccd2a2cfef8106be8c03174126c8e265c401ebba18b62253b0c2cc3a71088
Lib/pty.pyhttps://github.com/python/cpython/pull/21752/files#diff-6951c8bf11da0d5912302a24b778e2c968fae9212bfeb2e73de06ec257b2d1da
View file https://github.com/8vasu/cpython/blob/bf2f1b2ddce04fafb50bdb0b48501379c9463f82/Lib/pty.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21752/{{ revealButtonHref }}
https://github.com/python/cpython/pull/21752/files#diff-6951c8bf11da0d5912302a24b778e2c968fae9212bfeb2e73de06ec257b2d1da
https://github.com/python/cpython/pull/21752/files#diff-6951c8bf11da0d5912302a24b778e2c968fae9212bfeb2e73de06ec257b2d1da
https://github.com/python/cpython/pull/21752/files#diff-6951c8bf11da0d5912302a24b778e2c968fae9212bfeb2e73de06ec257b2d1da
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467631195
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 13, 2020https://github.com/python/cpython/pull/21752/files#r470012662
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://www.man7.org/linux/man-pages/man3/login_tty.3.htmlhttps://www.man7.org/linux/man-pages/man3/login_tty.3.html
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467629699
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://www.man7.org/linux/man-pages/man4/tty_ioctl.4.htmlhttps://www.man7.org/linux/man-pages/man4/tty_ioctl.4.html
https://docs.python.org/3/library/fcntl.html?highlight=ioctl#fcntl.ioctlhttps://docs.python.org/3/library/fcntl.html?highlight=ioctl#fcntl.ioctl
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467630695
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://man7.org/linux/man-pages/man3/openpty.3.htmlhttps://man7.org/linux/man-pages/man3/openpty.3.html
https://docs.python.org/3/library/pty.html?highlight=openpty#pty.openptyhttps://docs.python.org/3/library/pty.html?highlight=openpty#pty.openpty
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467631271
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://man7.org/linux/man-pages/man2/close.2.htmlhttps://man7.org/linux/man-pages/man2/close.2.html
https://docs.python.org/3/library/os.html?highlight=os%20close#os.closehttps://docs.python.org/3/library/os.html?highlight=os%20close#os.close
https://man7.org/linux/man-pages/man3/termios.3.htmlhttps://man7.org/linux/man-pages/man3/termios.3.html
https://docs.python.org/3/library/termios.htmlhttps://docs.python.org/3/library/termios.html
https://man7.org/linux/man-pages/man2/sigaction.2.htmlhttps://man7.org/linux/man-pages/man2/sigaction.2.html
https://docs.python.org/3/library/signal.html#signal.signalhttps://docs.python.org/3/library/signal.html#signal.signal
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467632042
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://en.wikipedia.org/wiki/Zombie_processhttps://en.wikipedia.org/wiki/Zombie_process
https://man7.org/linux/man-pages/man2/wait.2.htmlhttps://man7.org/linux/man-pages/man2/wait.2.html
https://docs.python.org/3/library/os.html?highlight=waitpid#os.waitpidhttps://docs.python.org/3/library/os.html?highlight=waitpid#os.waitpid
https://man7.org/linux/man-pages/man2/kill.2.htmlhttps://man7.org/linux/man-pages/man2/kill.2.html
https://docs.python.org/3/library/os.html?highlight=kill#os.killhttps://docs.python.org/3/library/os.html?highlight=kill#os.kill
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467632646
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://man7.org/linux/man-pages/man2/select.2.htmlhttps://man7.org/linux/man-pages/man2/select.2.html
https://docs.python.org/3/library/select.html?highlight=select#select.selecthttps://docs.python.org/3/library/select.html?highlight=select#select.select
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
8vasuhttps://github.com/8vasu
Aug 9, 2020https://github.com/python/cpython/pull/21752/files#r467633062
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://bugs.python.org/issue29070https://bugs.python.org/issue29070
https://bugs.python.org/issue26228https://bugs.python.org/issue26228
Please reload this pagehttps://github.com/python/cpython/pull/21752/files
Misc/NEWS.d/next/Library/2020-08-07-08-47-08.bpo-41494.ql-kB9.rsthttps://github.com/python/cpython/pull/21752/files#diff-8acccd2a2cfef8106be8c03174126c8e265c401ebba18b62253b0c2cc3a71088
View file https://github.com/8vasu/cpython/blob/bf2f1b2ddce04fafb50bdb0b48501379c9463f82/Misc/NEWS.d/next/Library/2020-08-07-08-47-08.bpo-41494.ql-kB9.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21752/{{ revealButtonHref }}
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.