comp.lang.ada
 help / color / mirror / Atom feed
From: John Smith <yoursurrogategod@gmail.com>
Subject: Trying to execute a command from inside of Ada
Date: Sun, 3 Jun 2018 20:17:31 -0700 (PDT)
Date: 2018-06-03T20:17:31-07:00	[thread overview]
Message-ID: <08857a7e-59ae-423e-a683-388df808133d@googlegroups.com> (raw)

Hello,

I found the following example:

http://rosettacode.org/wiki/Execute_a_system_command#Ada

And this is how I tried to adapt it to Linux:





with Interfaces.C;

with Ada.Text_IO;     use Ada.Text_IO;
with GNAT.OS_Lib;     use GNAT.OS_Lib;

procedure Sys_Command is
   Result    : Integer;
   Arguments : Argument_List :=
                 (  1=> new String'("bash"),
                    2=> new String'("ls -l ~")
                 );
begin
   Spawn
   (  Program_Name           => "bash",
      Args                   => Arguments,
      Output_File_Descriptor => Standout,
      Return_Code            => Result
   );
   for Index in Arguments'Range loop
      Free (Arguments (Index)); -- Free the argument list
   end loop;
end Sys_Command;




The problem is that 'ls -l ~' is not executed correctly.  I don't see any out put at all.  What am I doing wrong?

             reply	other threads:[~2018-06-04  3:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  3:17 John Smith [this message]
2018-06-04  4:42 ` Trying to execute a command from inside of Ada ytomino
2018-06-04  6:44 ` Jacob Sparre Andersen
replies disabled

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