This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about cygwin process behaviour and bash interactivemode


On Sat, 14 Sep 2002, Christopher Faylor wrote:

> On Sat, Sep 14, 2002 at 01:52:42PM -0400, Igor Pechtchanski wrote:
> >Quoting from isatty source (newlib/libc/posix/isatty.c:12):
> >
> >  if (fstat (fd, &buf) < 0)
> >    return 0;
> >  if (S_ISCHR (buf.st_mode))
> >    return 1;
> >  return 0;
> >
> >So, isatty() simply checks if the file descriptor given is a character
> >device or not.  I'm not sure quite how this works with windows programs
> >started from bash.
>
> Just a clarification:  The 'isatty' that cygwin exports comes from
> winsup/syscalls.cc:
>
>   extern "C" int
>   isatty (int fd)
>   {
>     int res;
>     sigframe thisframe (mainthread);
>
>     cygheap_fdget cfd (fd);
>     if (cfd < 0)
>       res = 0;
>     else
>       res = cfd->is_tty ();
>     syscall_printf ("%d = isatty (%d)", res, fd);
>     return res;
>   }
>
> It specifically checks if the fd in question is a tty.
>
> I have no comments for the rest of the discussion but I wanted to make
> this point clear.
>
> cgf

Thanks for clarifying this.  I'm assuming that cmd.exe treats its file
descriptors in the same way, no matter where it's started from (as it
doesn't automatically detect whether to start in an interactive mode).
So the question basically is: what are the properties of the file
descriptors that bash passes to windows processes started from it?
Anyone?
	Igor
P.S. I don't see the behavior that the original poster described on my
Win2k SP2 system...
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]