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

Better MSys PTY detection #102

Merged
merged 2 commits into from Apr 22, 2015
Merged

Better MSys PTY detection #102

merged 2 commits into from Apr 22, 2015

Conversation

kblees
Copy link

@kblees kblees commented Apr 20, 2015

This fixes issue #85 and part of issue #74

dscho and others added 2 commits April 20, 2015 18:51
This reverts commit 04cde24.

The MSYS_TTY_HANDLES trick doesn't work in a second shell window.

Additionally, #undef'ing 'isatty()' at the top of mingw.c breaks yes / no
questions (ask_yes_no_if_possible()) and probably other uses of isatty()
in mingw.c.

Signed-off-by: Karsten Blees <blees@dcon.de>
MSys2 emulates pseudo terminals via named pipes, and isatty() returns 0
for such file descriptors. Therefore, some interactive functionality (such
as launching a pager, asking if a failed unlink should be repeated etc.)
doesn't work when run in a terminal emulator that uses MSys ptys (such as
mintty).

However, MSys uses special names for its pty pipes ('msys-*-pty*'), which
allows us to distinguish them from normal piped input / output.

On startup, check if stdin / stdout / stderr are connected to such pipes
using the NtQueryObject API from NTDll.dll. If the names match, adjust the
flags in MSVCRT's ioinfo structure accordingly.

Signed-off-by: Karsten Blees <blees@dcon.de>
@kblees kblees mentioned this pull request Apr 20, 2015
3 tasks
@dscho
Copy link
Member

dscho commented Apr 21, 2015

Sorry about the amount of comments, but I am pretty jazzed about your approach: it makes much more sense than my original code.

@dscho
Copy link
Member

dscho commented Apr 22, 2015

See master...dscho:kb/msys-tty for my suggested changes.

@kblees don't worry if you do not have time to review or comment, I'll just go with what I have, perform a merging rebase onto 2.3.6 and then we'll take it from there, okay?

@dscho dscho merged commit 7d57fb4 into git-for-windows:master Apr 22, 2015
dscho added a commit that referenced this pull request Apr 22, 2015
Better MSys PTY detection

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho added the git label Apr 22, 2015
@kblees
Copy link
Author

kblees commented May 6, 2015

don't worry if you do not have time to review or comment, I'll just go with what I have

@dscho Thanks, I've been AFK for the past two weeks, still working off the backlog...

@dscho
Copy link
Member

dscho commented May 6, 2015

No worries! Hope you had a good time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants