Skip to content

Extend IO#tty? to recognize Windows PTYs - #139

Merged
nobu merged 9 commits into
masterfrom
feature/wintty_p
Aug 2, 2026
Merged

Extend IO#tty? to recognize Windows PTYs#139
nobu merged 9 commits into
masterfrom
feature/wintty_p

Conversation

@nobu

@nobu nobu commented Aug 1, 2026

Copy link
Copy Markdown
Member

MSYS2 and Cygwin terminals are represented by pipe handles on Windows, so the default IO#tty? cannot recognize them as terminal devices. Provide optional terminal type arguments so callers such as Reline can detect these environments without calling Win32 APIs directly.

IO#tty? and IO#isatty now accept :msys, :cygwin, and :any. Multiple types can be combined, while nil explicitly selects the default tty check.

io.tty?(:msys, :cygwin)
io.tty?(nil, :msys)
io.tty?(:any)

The no-argument behavior remains unchanged.
Tests cover ordinary PTYs, non-tty streams, multiple arguments, nil, :any, and invalid arguments.

@nobu
nobu merged commit 3708c0c into master Aug 2, 2026
62 checks passed
@nobu
nobu deleted the feature/wintty_p branch August 2, 2026 09:00
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