with Text_Io;
with System.OS_Lib;
use System;
with Sp.Version, Sp.Versions;
use Sp.Versions;
use Sp;
procedure Selfperformer is
Success : Boolean;
begin
-- compilling;
declare
Normal_Args : Os_Lib.Argument_List(1..2) :=
(new String ' ("src/selfperformer.adb" ),
new String ' ("-aI./src/lib" ));
Compiler_Name : Os_Lib.String_Access := new String ' ("/usr/bin/gnatmake" );
begin
Os_Lib.Normalize_Arguments(Normal_Args);
Os_Lib.Spawn(Compiler_Name.all, Normal_Args, success);
end;
delay 0.02;
-- call self
if Success then
Text_Io.Put_line("Success" );
declare
Bin : Os_Lib.String_Access := new String ' ("./selfperformer" );
Normal_Args : Os_Lib.Argument_List(1..1) := (1 => new String ' ("" ));
Self_id : Os_Lib.Process_Id;
begin
Version.Running_Version := Upgrade(Version.Running_Version);
Text_Io.Put_Line("selperformer.version ::= " & Image(Version.Running_Version));
Os_Lib.Normalize_Arguments(Normal_Args);
self_Id := Os_Lib.Non_Blocking_Spawn(bin.all, Normal_Args);
end;
end if;
end Selfperformer;