Commit 6fb40a4
mingw: make isatty() recognize MSys pseudo terminals (/dev/pty*)
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 <[email protected]>1 parent a7c8a59 commit 6fb40a4
2 files changed
+56
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
485 | 486 | | |
486 | 487 | | |
487 | 488 | | |
| |||
529 | 530 | | |
530 | 531 | | |
531 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
532 | 572 | | |
533 | 573 | | |
534 | 574 | | |
| |||
537 | 577 | | |
538 | 578 | | |
539 | 579 | | |
540 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
541 | 587 | | |
| 588 | + | |
542 | 589 | | |
543 | 590 | | |
544 | 591 | | |
| |||
574 | 621 | | |
575 | 622 | | |
576 | 623 | | |
577 | | - | |
578 | | - | |
579 | | - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
580 | 630 | | |
581 | 631 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
556 | | - | |
| 556 | + | |
| 557 | + | |
557 | 558 | | |
558 | 559 | | |
559 | 560 | | |
| |||
0 commit comments