From c5247489a29b1609b688aebcb4748d6782211157 Mon Sep 17 00:00:00 2001 From: Jano at Zelda Date: Thu, 8 Feb 2018 12:48:26 +0100 Subject: [PATCH] Added bypassing spawn --- src/alire-os_lib.adb | 15 +++++++++++++++ src/alire-os_lib.ads | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/alire-os_lib.adb b/src/alire-os_lib.adb index 9b3e2427..9cb1b247 100644 --- a/src/alire-os_lib.adb +++ b/src/alire-os_lib.adb @@ -177,6 +177,21 @@ package body Alire.OS_Lib is end if; end Spawn; + ------------------ + -- Spawn_Bypass -- + ------------------ + + procedure Spawn_Bypass (Command : String; + Arguments : String := "") + is + Code : constant Integer := Spawn (Locate_In_Path (Command), + Argument_String_To_List (Arguments).all); + begin + if Code /= 0 then + raise Program_Error with "Exit code:" & Code'Image; + end if; + end Spawn_Bypass; + ------------------ -- Enter_Folder -- ------------------ diff --git a/src/alire-os_lib.ads b/src/alire-os_lib.ads index 8ebebbb7..6efa04e6 100644 --- a/src/alire-os_lib.ads +++ b/src/alire-os_lib.ads @@ -15,6 +15,10 @@ package Alire.OS_Lib is Force_Quiet : Boolean := False); -- Raises PROGRAM_ERROR if exit code /= 0 + procedure Spawn_Bypass (Command : String; + Arguments : String := ""); + -- Direct launch, without any shenanigangs on output, for example for respawning the canonical version + type Folder_Guard (<>) is limited private; -- use this type in conjunction with Enter_Folder to ensure that -- the CWD is modified and restored when creating/destroying the Folder_Guard