From 11a2042b61616ad1435b6d0cfbbeafd0b085e3d7 Mon Sep 17 00:00:00 2001 From: "alex@thor" Date: Fri, 9 Feb 2018 00:28:18 +0100 Subject: [PATCH] Report error code on spawn --- src/alire-os_lib.adb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/alire-os_lib.adb b/src/alire-os_lib.adb index 9cb1b247..beccd5f4 100644 --- a/src/alire-os_lib.adb +++ b/src/alire-os_lib.adb @@ -101,15 +101,19 @@ package body Alire.OS_Lib is end; end loop; - declare - Line : constant String := Ada.Characters.Latin_1.CR & Simple_Command & " completed"; - begin - Max_Len := Natural'Max (Max_Len, Simple_Command'length + 2); -- If there weren't any output - Put_Line (Line & String'(1 .. Max_Len - Line'Length => ' ')); - end; - return Code : Integer do Close (Pid, Code); + + declare + Line : constant String := + Ada.Characters.Latin_1.CR & Simple_Command & + (if Code = 0 + then " completed" + else " ended with error (exit code" & Code'Img & ")"); + begin + Max_Len := Natural'Max (Max_Len, Simple_Command'length + 2); -- If there weren't any output + Put_Line (Line & String'(1 .. Max_Len - Line'Length => ' ')); + end; end return; end Spawn_With_Progress;