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.

Author digitaldragon
Recipients digitaldragon
Date 2021-03-03.13:34:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614778462.01.0.596151563335.issue43387@roundup.psfhosted.org>
In-reply-to
Content
The pydoc tool can serve a website for browsing the docs interactively with the -p or -b option. While serving, it enters a simple command line interface:
Server commands: [b]rowser, [q]uit
server> 

Because it is reading from stdin, it is not possible to straightforwardly run the progress in the background of a linux shell. Normally, this is achieved by appending a & to the command, starting it in the background, or using the shell's job control features to put it in the background after starting normally: Usually Ctrl-Z and issuing the command 'bg'.

In both cases, any attempt to read from stdin causes a SIGTTIN signal, suspending the process if not caught. The webserver then cannot process any requests.

I reproduced the behavior in python versions 3.5, 3.7, 3.8 and 3.9. In 2.7, no interactive interface is present.

Possible fixes:
- remove the interactive command line altogether (it does not offer more functionality than the -b flag, and the shell's handling of Ctrl-C, which sends a SIGINT anyway)
- catch SIGTTIN (handles a subsequent sending-to-background)
- detecting if started in background (https://stackoverflow.com/a/24862213, can't handle subsequent sending-to-background)
History
Date User Action Args
2021-03-03 13:34:22digitaldragonsetrecipients: + digitaldragon
2021-03-03 13:34:22digitaldragonsetmessageid: <1614778462.01.0.596151563335.issue43387@roundup.psfhosted.org>
2021-03-03 13:34:22digitaldragonlinkissue43387 messages
2021-03-03 13:34:21digitaldragoncreate