homepage

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 ronaldoussoren
Recipients amoffat, loewis, ned.deily, ronaldoussoren
Date 2019年07月14日.13:56:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563112589.32.0.0147013788102.issue15898@roundup.psfhosted.org>
In-reply-to
Content
This is IMHO not a bug in Python, the problem can been seen when you rewrite the code in msg170261 in C, see the code below.
An observation with the C code below: Both moving ``close(slave)`` to above the sleep or removing that close entirely fixes the problem for me. Likewise with adding ``usleep(700000);`` to the child before exiting.
It is unclear to me who's at fault here, this could be a bug in the macOS kernel but could also be a bug in this code. It looks like the output is lost when ``close(slave)`` happens after the child proces has exited.
BTW. All testing was done on macOS 10.14.5, with python 3.8.
Anyway: I propose closing this issue because this is not a bug in CPython.
/* The C code used to test system behaviour */
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <util.h>
int main(void)
{
	int master, slave;
	int r;
	pid_t pid;
	r = openpty(&master, &slave, NULL, NULL, NULL);
	if (r == -1) {
		perror("openpty");
		exit(1);
	}
	pid = fork();
	if (pid == 0) {
		/* child */
		setsid();
		close(master);
		dup2(slave, 0);
		dup2(slave, 1);
		dup2(slave, 2);
		close(slave);
 		write(1, "testing", 7);
		_exit(255);
	} else {
		/* parent */
		char buf[1024];
		usleep(500000); /* 0.5 */
		close(slave);
		r = read(master, buf, 1024);
		if (r == -1) {
			perror("read");
			exit(1);
		}
		printf("%d\n", r);
		write(1, buf, r);
		kill(pid, SIGKILL);
	}
}
History
Date User Action Args
2019年07月14日 13:56:29ronaldoussorensetrecipients: + ronaldoussoren, loewis, ned.deily, amoffat
2019年07月14日 13:56:29ronaldoussorensetmessageid: <1563112589.32.0.0147013788102.issue15898@roundup.psfhosted.org>
2019年07月14日 13:56:29ronaldoussorenlinkissue15898 messages
2019年07月14日 13:56:28ronaldoussorencreate

AltStyle によって変換されたページ (->オリジナル) /