classification
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
process
Status: closed Resolution: duplicate
Dependencies: Superseder: pty.spawn hangs on FreeBSD 9.3, 10.x
View: 26228
Assigned To: Nosy List: jarryshaw, martin.panter
Priority: normal Keywords: patch

Created on 2018-09-24 07:25 by jarryshaw, last changed 2019-02-26 03:03 by jarryshaw. This issue is now closed.

Files
File name Uploaded Description Edit
pty-diff.patch jarryshaw, 2018-09-24 07:25 git diff patch file of Lib/pty.py
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.
History
Date User Action Args
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
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