comp.lang.ada
 help / color / mirror / Atom feed
* Trying to execute a command from inside of Ada
@ 2018-06-04  3:17 John Smith
  2018-06-04  4:42 ` ytomino
  2018-06-04  6:44 ` Jacob Sparre Andersen
  0 siblings, 2 replies; 3+ messages in thread
From: John Smith @ 2018-06-04  3:17 UTC (permalink / 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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-04  6:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04  3:17 Trying to execute a command from inside of Ada John Smith
2018-06-04  4:42 ` ytomino
2018-06-04  6:44 ` Jacob Sparre Andersen

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