From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8adae758db494f09,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!b28g2000cwb.googlegroups.com!not-for-mail From: "Jens K S" Newsgroups: comp.lang.ada Subject: how to use GNAT.Expect Date: 24 Jul 2006 08:14:57 -0700 Organization: http://groups.google.com Message-ID: <1153754097.448111.251710@b28g2000cwb.googlegroups.com> NNTP-Posting-Host: 70.19.95.165 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1153754102 22642 127.0.0.1 (24 Jul 2006 15:15:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 24 Jul 2006 15:15:02 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.4) Gecko/20060613 Camino/1.0.2,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: b28g2000cwb.googlegroups.com; posting-host=70.19.95.165; posting-account=jyjYEA0AAAASGPmGV3SixZnGCmSWvjj8 Xref: g2news2.google.com comp.lang.ada:5898 Date: 2006-07-24T08:14:57-07:00 List-Id: 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