Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pty.spawn deadlock #96522

Copy link
Copy link
Closed
Closed
Copy link
@zhangyoufu

Description

@zhangyoufu
Issue body actions

Bug report

% yes | python3 -c "import pty; pty.spawn(['cat'])"
y
...
y^CTraceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/pty.py", line 181, in spawn
    _copy(master_fd, master_read, stdin_read)
  File "/usr/lib/python3.10/pty.py", line 161, in _copy
    _writen(master_fd, data)
  File "/usr/lib/python3.10/pty.py", line 127, in _writen
    n = os.write(fd, data)
KeyboardInterrupt

You will see 2048 lines of y due to tty echo, then the output stops and hangs forever.
Both python and cat block on write, waiting each other consume something from pty buffer.

Your environment

Tested on Linux/macOS with CPython 3.10.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.