pypy3: os.exec(pypy3) blocks on stdin on Windows
os.exec() causes the child process to block reading data from
stdin before the script begins executing. To demonstrate, create
import os, sys os.execl(sys.executable, sys.executable, '-c', "print('HERE')")
pypy3 example.py in
pwsh. Observe that a prompt for the next command appears, but "HERE" is not printed. Wait a few seconds, then press Enter and "HERE" will be printed along with the next prompt.
pypy3 example.py <nul in
$null | pypy3 example.py in
pwsh. Observe that "HERE" is printed immediately.
stdin does not occur when executing
cmd, as in the following script:
import os, sys os.execl('C:\Windows\System32\cmd.exe', 'C:\Windows\System32\cmd.exe', '/c', 'echo HERE')
"HERE" is printed immediately whether or not
stdin is redirected.
The blocking occurs with pypy3.7-v7.3.5-win64 and every Pypy3 release I tested back to pypy3-v5.10.0-win32. It does not occur on pypy2.7-v7.3.5-win64 or on cpython 3.9.5.