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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: using GNAT.Expect? References: <85vbguye6h.fsf@stephe-leake.org> Date: Mon, 20 Apr 2015 10:55:46 -0500 Message-ID: <85pp6y94l9.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) Cancel-Lock: sha1:oL3BrBy7iTPWfvZVXtU/WD0eRJQ= MIME-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: ac88b55352182e97f808413204 X-Received-Bytes: 1645 X-Received-Body-CRC: 3865791447 Xref: news.eternal-september.org comp.lang.ada:25558 Date: 2015-04-20T10:55:46-05:00 List-Id: Stephen Leake writes: > I'm trying to use GNAT.Expect to run sftp in a spawned process. > > It mostly works, but I'm having trouble waiting for the results of a > command properly. > > It would be simple if I could always wait for the prompt "sftp>", but > GNAT.Expect doesn't see that until the next command is echoed. I'm > guessing there is some layer that is waiting for a newline. I worked around this by always sending a second empty command: Send (Protocol.Process, Command & LF & LF, Add_LF => False, Empty_Buffer => True); -- If we wait long enough, sftp will output: -- -- LF LF LF -- -- However Expect requires an LF before seeing anything, so the -- Expect buffer will contain: -- -- LF LF LF -- -- where the first is left over from the previous command. -- -- -- Stephe