comp.lang.ada
 help / color / mirror / Atom feed
From: "Jens K S" <jens.schoedt@gmail.com>
Subject: Re: how to use GNAT.Expect
Date: 28 Jul 2006 11:23:00 -0700
Date: 2006-07-28T11:23:00-07:00	[thread overview]
Message-ID: <1154110979.998477.30620@h48g2000cwc.googlegroups.com> (raw)
In-Reply-To: 1153754097.448111.251710@b28g2000cwb.googlegroups.com

After downloading the newest AdaCore GNAT compiler for OS X the problem
is gone.

Jens K S wrote:
> Hi all,
>
> I new to Ada and I've been fiddling with this problem for too long
> now.
> Basically I want to transfer some files using Ada, but since I don't
> want to create my own FTP implementation I want to start a new FTP
> process from Ada (I use echo in example below). Works fine with
> GNAT.OS_Lib, but when I use GNAT.Expect I get no output and an
> exception?? What am I doing wrong here?
>
> By the way, I use Xcode on OS X. Does anyone know how I can "Step
> Into" code in the Expect package? This could also help me locate the
> problem....
>
> -------------------------- code -------------------------------
> with Ada.Text_io;
> use Ada.Text_io;
> with GNAT.Expect;
> with GNAT.OS_Lib;
>
> procedure ClonesTest is
>
> 	Fd: GNAT.Expect.Process_Descriptor;
> 	Timeout: Integer := 10000; -- 10 sec
> 	Result: GNAT.Expect.Expect_Match;
> 	Sucess: boolean;
> 	P: GNAT.OS_Lib.Process_Id;
> begin
>
> 	-- using Lib
> 	P:= GNAT.OS_Lib.Non_Blocking_Spawn("/bin/echo", (1 => new String'
> ("from Lib Non_Block")));
> 	GNAT.OS_Lib.Spawn ("/bin/echo", (1 => new String' ("from Lib Block")),
> Sucess);
>
> 	-- using Expect
> 	GNAT.Expect.Non_Blocking_Spawn (Fd, "/bin/echo", (1 => new String'
> ("from Expect")));
> 	GNAT.Expect.Expect (Fd, Result, ".*", Timeout);
> 	Put_Line ("Seen: " & GNAT.Expect.Expect_Out (Fd));
>
>     Put_Line("Hello, World again with Ada!");
>
> end ClonesTest;
>
>
> --------------- Output ---------------
>
> from Lib Non_Block
> from Lib Block
>
> raised GNAT.EXPECT.PROCESS_DIED : g-expect.adb:594
>
> ClonesTest has exited with status 1.
> 
> 
> Thanks in advance
> 
> Jens




      parent reply	other threads:[~2006-07-28 18:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-24 15:14 how to use GNAT.Expect Jens K S
2006-07-24 17:15 ` Samuel Tardieu
2006-07-24 18:52   ` Jens K S
2006-07-25  7:33     ` Samuel Tardieu
2006-07-25  8:51     ` Alex R. Mosteo
2006-07-25 18:40       ` Jens K S
2006-07-24 19:36 ` Simon Wright
2006-07-28 18:23 ` Jens K S [this message]
replies disabled

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