Spawn refactor
This commit is contained in:
+14
-15
@@ -3,33 +3,32 @@ with Ada.Finalization;
|
|||||||
|
|
||||||
package Alire.OS_Lib is
|
package Alire.OS_Lib is
|
||||||
|
|
||||||
function Spawn (Command : String;
|
function Spawn (Command : String;
|
||||||
Arguments : String := "") return Integer;
|
Arguments : String := "") return Integer;
|
||||||
-- Returns exit code
|
|
||||||
|
procedure Spawn (Command : String;
|
||||||
procedure Spawn (Command : String;
|
|
||||||
Arguments : String:= "");
|
Arguments : String:= "");
|
||||||
-- Raises PROGRAM_ERROR if exit code /= 0
|
-- Raises PROGRAM_ERROR if exit code /= 0
|
||||||
|
|
||||||
type Folder_Guard (<>) is limited private;
|
type Folder_Guard (<>) is limited private;
|
||||||
-- use this type in conjunction with Enter_Folder to ensure that
|
-- use this type in conjunction with Enter_Folder to ensure that
|
||||||
-- the CWD is modified and restored when creating/destroying the Folder_Guard
|
-- the CWD is modified and restored when creating/destroying the Folder_Guard
|
||||||
|
|
||||||
function Enter_Folder (Path : String) return Folder_Guard;
|
function Enter_Folder (Path : String) return Folder_Guard;
|
||||||
|
|
||||||
function Stay_In_Current_Folder return Folder_Guard;
|
function Stay_In_Current_Folder return Folder_Guard;
|
||||||
|
|
||||||
function "/" (L, R : String) return String is
|
function "/" (L, R : String) return String is
|
||||||
(Ada.Directories.Compose (L, R));
|
(Ada.Directories.Compose (L, R));
|
||||||
-- Shorthand for path composition
|
-- Shorthand for path composition
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Folder_Guard (Original_Len : Natural) is new Ada.Finalization.Limited_Controlled with record
|
type Folder_Guard (Original_Len : Natural) is new Ada.Finalization.Limited_Controlled with record
|
||||||
Original : String (1 .. Original_Len);
|
Original : String (1 .. Original_Len);
|
||||||
Initialized : Boolean := False;
|
Initialized : Boolean := False;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
overriding procedure Finalize (This : in out Folder_Guard);
|
overriding procedure Finalize (This : in out Folder_Guard);
|
||||||
|
|
||||||
end Alire.OS_Lib;
|
end Alire.OS_Lib;
|
||||||
|
|||||||
Reference in New Issue
Block a user