Skip to content

Fix stdin hang in non-TTY environments (sockets, PTY slaves) - #18

Open
rethab wants to merge 3 commits into
mainfrom
fix/issue-948
Open

Fix stdin hang in non-TTY environments (sockets, PTY slaves)#18
rethab wants to merge 3 commits into
mainfrom
fix/issue-948

Conversation

@rethab

@rethab rethab commented Jul 12, 2026

Copy link
Copy Markdown
Owner

StdinHasData() only checked whether stdin was a terminal and treated every other file descriptor as having data ready to read. That is true for regular files and pipes, but not for sockets or open PTY slaves, which never signal EOF. When stdin was one of those descriptors, commands that read the description/body from stdin (issue create, epic create, comment add, issue edit) would block forever on io.ReadAll, even when --no-input was passed, since the stdin read happens unconditionally before the no-input check.

This changes StdinHasData() to stat stdin and only report data available for regular files and named pipes, falling back to false for everything else (including on stat errors), so callers skip the blocking read instead of hanging.

Addresses ankitpokhrel#948.

rethab added 3 commits July 12, 2026 07:04
StdinHasData() treated any non-terminal fd as having data to read,
including sockets and open PTY slaves that never signal EOF. This
caused issue create/edit, epic create, and comment add (even with
--no-input) to hang forever when stdin was such a descriptor in
non-TTY environments like subprocesses or CI runners.

Now only regular files and named pipes are considered to have data;
anything else falls back to no data instead of blocking on read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant