comp.lang.ada
 help / color / mirror / Atom feed
* gnat expect - help please
@ 2009-01-16 16:27 RasikaSrinivasan
  2009-01-17 20:41 ` xavier grave
  0 siblings, 1 reply; 3+ messages in thread
From: RasikaSrinivasan @ 2009-01-16 16:27 UTC (permalink / 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 ;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnat expect - help please
  2009-01-16 16:27 gnat expect - help please RasikaSrinivasan
@ 2009-01-17 20:41 ` xavier grave
  2009-01-17 23:35   ` RasikaSrinivasan
  0 siblings, 1 reply; 3+ messages in thread
From: xavier grave @ 2009-01-17 20:41 UTC (permalink / raw)
  To: RasikaSrinivasan@gmail.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have tried your program (I modified "Password:" to "password :"
because of my scp output) and I have also a timeout. May be this is
related that the output of the scp isn't on stdout but somewhere else ?
I tried to redirect to a file without much success.

I have also tried with Err_To_Out set to true without much success.

Maybe somebody else ?
Sorry for being so little helpful.
xavier

RasikaSrinivasan@gmail.com a �crit :
> 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 ;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklyQoYACgkQVIZi0A5BZF7K0ACgvcSx5A3cu+Y02HlfrCOy4oeA
C/8AoJQNAHoJQuEiYbhX27a2X1E0uECW
=vL5W
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnat expect - help please
  2009-01-17 20:41 ` xavier grave
@ 2009-01-17 23:35   ` RasikaSrinivasan
  0 siblings, 0 replies; 3+ messages in thread
From: RasikaSrinivasan @ 2009-01-17 23:35 UTC (permalink / raw)


On Jan 17, 3:41 pm, xavier grave <xavier.gr...@ipno.in2p3.fr> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I have tried your program (I modified "Password:" to "password :"
> because of my scp output) and I have also a timeout. May be this is
> related that the output of the scp isn't on stdout but somewhere else ?
> I tried to redirect to a file without much success.
>
> I have also tried with Err_To_Out set to true without much success.
>
> Maybe somebody else ?
> Sorry for being so little helpful.
> xavier
>
> RasikaSriniva...@gmail.com a écrit :
>
>
>
> > 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 ;
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAklyQoYACgkQVIZi0A5BZF7K0ACgvcSx5A3cu+Y02HlfrCOy4oeA
> C/8AoJQNAHoJQuEiYbhX27a2X1E0uECW
> =vL5W
> -----END PGP SIGNATURE-----

thanks for trying. i made some progress on windows xp but have not met
with success yet. thanks, srini



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-17 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-16 16:27 gnat expect - help please RasikaSrinivasan
2009-01-17 20:41 ` xavier grave
2009-01-17 23:35   ` RasikaSrinivasan

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