This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: pty.spawn -- auto-termination after child process is dead (a zombie)
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5
Status: closed Resolution: duplicate
Dependencies: Superseder: pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1
View: 26228
Assigned To: Nosy List: jarryshaw, martin.panter
Priority: normal Keywords: patch

Created on 2018-09-24 07:25 by jarryshaw, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit
pty-diff.patch jarryshaw, 2018-09-24 07:25 git diff patch file of Lib/
Pull Requests
URL Status Linked Edit
PR 9525 closed jarryshaw, 2018-09-24 08:10
Messages (4)
msg326206 - (view) Author: Jarry Shaw (jarryshaw) * Date: 2018-09-24 07:25
As in pty.spawn, once started, the parent process will be hanged, even if the child process is already dead (or a zombie), and must wait for a KeyboardInterrupt or else to terminate the whole process.

Thus, I propose to revise `_copy` function, where the parent process hung, to check if the child process is dead periodically and if so, terminate the whole process then return as shown in the patch file.
msg326695 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-09-29 23:09
Is this to get “spawn” working on a non-Linux platform like a recent Free BSD, OS X, or Solaris? If so, see Issue 26228.

If not, you might have to explain your use case better. Polling for the child exiting is going to race with handling the child’s output, and if there are other processes writing to the terminal after the child exits this will change the behaviour.
msg336267 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2019-02-21 22:21
Suggest closing this assuming it is a duplicate, unless Jarry can give more information.
msg336598 - (view) Author: Jarry Shaw (jarryshaw) * Date: 2019-02-26 03:03
This issue is duplicated with issue26228, sorry.
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 78966
2019-02-26 03:03:58jarryshawsetstatus: pending -> closed

messages: + msg336598
stage: patch review -> resolved
2019-02-21 22:21:58martin.pantersetstatus: open -> pending
superseder: pty.spawn hangs on FreeBSD 9.3, 10.x, 12.1
resolution: duplicate
messages: + msg336267
2018-09-29 23:09:21martin.pantersetnosy: + martin.panter
messages: + msg326695
2018-09-24 08:10:12jarryshawsetstage: patch review
pull_requests: + pull_request8930
2018-09-24 07:25:19jarryshawcreate