Why can I not read from stdin in this forked process?
问题 The following code prints nothing, but it should print out "a" repeatedly. The forked process blocks on the os.read(0, 1). The parent process is indeed writing to the stdin_master, but stdin_slave receives nothing. Any ideas? import os import pty import resource import select import signal import time stdin_master, stdin_slave = pty.openpty() stdout_master, stdout_slave = pty.openpty() stderr_master, stderr_slave = pty.openpty() pid = os.fork() # child process if pid == 0: os.setsid() os