comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Execute an OS command and capture output
Date: Wed, 15 Nov 2017 19:00:49 -0600
Date: 2017-11-15T19:00:49-06:00	[thread overview]
Message-ID: <ouio02$ft6$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: ouchqn$1vo1$1@gioia.aioe.org


"Victor Porton" <porton@narod.ru> 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.


      parent reply	other threads:[~2017-11-16  1:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 16:38 Execute an OS command and capture output Victor Porton
2017-11-13 16:41 ` Victor Porton
2017-11-13 17:41 ` Dmitry A. Kazakov
2017-11-13 18:52   ` Victor Porton
2017-11-13 20:06     ` Dmitry A. Kazakov
2017-11-13 20:16       ` Victor Porton
2017-11-13 20:34         ` Dmitry A. Kazakov
2017-11-13 21:09           ` Victor Porton
2017-11-14  9:36             ` Dmitry A. Kazakov
2017-11-13 19:07   ` Victor Porton
2017-11-13 19:22     ` Victor Porton
2017-11-13 20:17     ` Dmitry A. Kazakov
2017-11-14 10:57     ` A. Cervetti
2017-11-13 21:32   ` briot.emmanuel
2017-11-16  1:00 ` Randy Brukardt [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