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!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Execute an OS command and capture output Date: Wed, 15 Nov 2017 19:00:49 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Thu, 16 Nov 2017 01:00:50 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="16294"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: feeder.eternal-september.org comp.lang.ada:48925 Date: 2017-11-15T19:00:49-06:00 List-Id: "Victor Porton" wrote in message news:ouchqn$1vo1$1@gioia.aioe.org... >I need a (preferably portable, but only Linux would be well) way to execute > an OS command with some input in stdin which I provide and capture the > output from stdout. There is no portable solution, as Ada does not provide any sort of OS access. You'll have to use something either compiler-specific (like the GNAT Spawn mentioned elsewhere or the Janus/Ada Prog_Call), or perhaps something in a library (most of which only work with GNAT anyway). We (the ARG) once tried to define a portable OS access. We discussed it for the better part of an hour and ended up arguing about a portable problem statement -- we couldn't even agree on how to portably describe the problem we were trying to solve. We eventually decided that we could make better use of our time working on something else (pretty much anything else!). So it's unlikely that Ada will ever get such a facility; it is very target-specific. It would be nice if all Windows compilers supported the same mechanism, but that would require herding cats (implementers) and probably would be a long shot. [Implementers don't even seem to support file information portably, even though the specification of Ada.Directories.Information for Windows and for Linux is provided in the AARM. For instance, my understanding is that GNAT doesn't implement either of these packages as specified there.] Randy.