This is the mail archive of the cygwin 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: Cannot change console mode during usage of expect


On Apr 15 17:57, Keith Proctor wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> > On Apr 15 01:17, Keith Proctor wrote:
> > > Hello, my name is Keith Proctor.  I test FileMaker Server and I have
> > > written a test suite on Macintosh.
> > > [...]
> > > The issue is that the following phrases appear and wonât allow
> > > my interactive expect command to continue.
> > > 
> > > GetConsoleMode	// prints once
> > > SetConsoleMode	// prints once
> > > ReadConsoleInput	// spews while collecting input from the command line.
> > 
> > I don't understand this.  What does Cygwin expect have to do
> >  with these underlying OS calls?!?  They only work in a console 
> > window and they are not to be suppsoed to be used by Cygwin
> >  executables since all the underlying OS details are (more or less)
> >  hidden behind the TTY code. Also, how are they supposed to work
> >  in a PTY which is constituted by  Named Pipes, not a console?  
> > And expect certainly uses PTYs to perform its pseudo-interactive stuff.
> > 
> Corinna,  Let me make this a little clearer fmsadmin application is making
> the 3 calls.  In this case fmsadmin is being called from expect and expect
> is the cause of the issue.

Well, not really.  The cause of the issue is that fmsadmin uses these
calls.  Fmsadmin apparently expects to run in a normal Windows console.
Expect on the other hand is a Cygwin POSIX application, so it's using
Cygwin PTYs and offers those as stdio descriptors to the inferior
application.

The problem here seems to be that you're expecting Cygwin to do
something it doesn't, and fmsadmin not being a Cygwin application
not being able to work seamlessly with a Cygwin POSIX appication
in this regard.

> On a very related note I see this same question being asked for years
> and the Cygwin answer has been change your code to work with
> Cygwin.  Unfortunately, I don't have that luxury.  fmsadmin is a
> DOS application.  I may never be able to get a fix for this issue in
> fmsadmin as our target is NOT Cygwin.  

Which makes me wonder if using Cygwin is the right thing to do here.

> BTW, I expect GetConsoleMode and SetConsoleMode is standard
> usage by any console application.  These calls work on Macintosh,
> Windows and Cygwin window without expect.

I have no idea what Mac you're talking about.  IIUC OS X is a BSD-based
system and it does not provide Windows-only calls.  And GetConsoleMode,
SetConsoleMode, and ReadConsoleInput are Windows calls.  I have a hard
time to believe that an OS X console uses the weird Windows console API.
Unless, of course, you're running a Windows fmsadmin tool under some OS
X Windows emulator.  Does wine for OS X exist?

As for Cygwin I'd like to stress that Cygwin tries to emulate POSIX in
the first place.  An application like expect will be compiled under
Cygwin as a POSIX application.  It will quite certainly not use or
understand Windows calls.  As a POSIX application, it will have no
notion of Windows consoles and it will use PTYs as communication
channels to the inferior process.  PTYs are Cygwin-specific, implemented
using named pipes under the hood.  Named Pipes very certainly don't
support the console API.

The bottom line is, the fmsadmin tool, as a native Windows application,
expects to perform I/O via the Windows Console.  Thus it uses the
Windows console API.  Cygwin's expect on the other hand, is implemented
as POSIX application and as such, uses POSIX means, PTYs.

I don't see how the two of them can come together.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpz2pcncWQwT.pgp
Description: PGP signature


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