comp.lang.ada
 help / color / mirror / Atom feed
From: "RasikaSrinivasan@gmail.com" <RasikaSrinivasan@gmail.com>
Subject: gnat expect - help please
Date: Fri, 16 Jan 2009 08:27:51 -0800 (PST)
Date: 2009-01-16T08:27:51-08:00	[thread overview]
Message-ID: <e033841d-2b2d-4735-8518-3742306b5653@r15g2000prh.googlegroups.com> (raw)

I have trouble with gnat.expect. Hope someone can spot what is wrong
or wrong with my understanding :

The following is a sample program that illustrates the problem :

- I was expecting the prompt "Password" to be hidden ie between my
process and the spawned process. instead i do see the prompt in my
bash session.

- so my call to gnat.expect.expect always fails with a timeout.

- after such a timeout my bash session behaves strange (no echo)

pointers appreciated.

Environment -

gnat-gpl-2007-i686-gnu-linux-libc2.3-bin.tar.gz
on Suse 10.2

================================================================
with Text_Io; use Text_Io ;
with System.Os_Lib ;
with Gnat.Expect ; use Gnat.Expect ;


procedure Hello is

   Pd : Gnat.Expect.Process_Descriptor ;
   Prompt : Gnat.Expect.Expect_Match ;
begin

   Gnat.Expect.Non_Blocking_Spawn( Pd ,
                                   "scp" ,
                                   ( 1 => new String'("hello") ,
                                     2 => new
String'("rs3@ichabod:bin/") )) ;
   Gnat.Expect.Expect(Pd,Prompt,"Password:",Timeout=>10000) ;
   if Prompt = Gnat.Expect.Expect_Timeout
     then
        Put_Line("Command timedout") ;
     else
        Put_Line(Gnat.Expect.Expect_Match'Image(Prompt));
   end if ;
end Hello ;



             reply	other threads:[~2009-01-16 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16 16:27 RasikaSrinivasan [this message]
2009-01-17 20:41 ` gnat expect - help please xavier grave
2009-01-17 23:35   ` RasikaSrinivasan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox