Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python mingw64 stdin error with subprocess pipe #22354

Open
2 of 6 tasks
gedare opened this issue Oct 30, 2024 · 0 comments
Open
2 of 6 tasks

Python mingw64 stdin error with subprocess pipe #22354

gedare opened this issue Oct 30, 2024 · 0 comments
Labels

Comments

@gedare
Copy link

gedare commented Oct 30, 2024

Description / Steps to reproduce the issue

  1. Create a subprocess with subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) in the usual way.
  2. Repeatedly write to the pipe's stdin and read from its stdout.
  3. At some point the pipe's stdin is unable to be written for no apparent reason. This seems to be a bug.

Reduced test case: test.txt

Compare the behavior with the msys2 python:

$ /usr/bin/python -V
Python 3.12.7
$ /usr/bin/python test.py

see Expected behavior

vs. failure on readline with mingw Python:

$ /mingw64/bin/python.exe -V
Python 3.11.10
$ /mingw64/bin/python.exe test.py

see Actual behavior

Expected behavior

0
b'test\n'
1
2
b'test\n'
...
17
b'test\n'
18
b'test\n'
19
b'test\n'
20
b'test\n'

Actual behavior

0
1
b'test\r\n'
Traceback (most recent call last):
File "", line 9, in
OSError: [Errno 22] Invalid argument
b''
Traceback (most recent call last):
File "C:/msys64/home/gedare/test.py", line 34, in
proc.stdin.flush()
OSError: [Errno 22] Invalid argument

Verification

Windows Version

MSYS_NT-10.0-26100

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANGARM64

Are you willing to submit a PR?

No response

@gedare gedare added the bug label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant