On Thu, 16 Mar 2017, at 23:00, Computer Jock wrote:
> I'm trying to duplicate the code in bash/test that checks that stdout is
> a "terminal". Compiling and running the following:
>
> #include <stdio.h>
> #include <io.h>
> int main( int ac, char **av ) {
> printf( "isatty(stdout): %s\n", isatty( fileno(stdout) )? "yes" : "no" );
> }
>
> returns "no" when run in mintty but "yes" for cmd|tcc.
>
> If I run bash or test from cmd|tcc, -t returns true >and< it returns
> true when run from mintty.
>
> I've downloaded the source for coreutils and bash but I can find nothing
> that appears in any way special.
>
> I noticed that ldd /usr/bin/test loads msys-2.0.dll while my program
> above loads msvcrt.dll
Try running your program with winpty (pacman -S winpty). isatty should return
true then :)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Msys2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msys2-users