From 9e91102156af7e6d91f429ad189db029cab123ee Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Wed, 7 Feb 2018 00:07:09 +0100 Subject: [PATCH] Spawn refactor --- src/alire-os_lib.ads | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/alire-os_lib.ads b/src/alire-os_lib.ads index 63349df6..8127f1f4 100644 --- a/src/alire-os_lib.ads +++ b/src/alire-os_lib.ads @@ -3,33 +3,32 @@ with Ada.Finalization; package Alire.OS_Lib is - function Spawn (Command : String; + function Spawn (Command : String; Arguments : String := "") return Integer; - -- Returns exit code - - procedure Spawn (Command : String; + + procedure Spawn (Command : String; Arguments : String:= ""); - -- Raises PROGRAM_ERROR if exit code /= 0 - + -- Raises PROGRAM_ERROR if exit code /= 0 + 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 - - 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 "/" (L, R : String) return String is (Ada.Directories.Compose (L, R)); -- Shorthand for path composition - + private - + type Folder_Guard (Original_Len : Natural) is new Ada.Finalization.Limited_Controlled with record Original : String (1 .. Original_Len); Initialized : Boolean := False; end record; - - overriding procedure Finalize (This : in out Folder_Guard); + + overriding procedure Finalize (This : in out Folder_Guard); end Alire.OS_Lib;