From ab86402e2d236436ed2b4c246fb1741c6b3c6425 Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Fri, 16 Oct 2020 00:25:51 +0800
Subject: [PATCH] WIP: allow to report the exit code of the background job.

---
 .build.ci.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/.build.ci.sh b/.build.ci.sh
index 0ea25cd0..9833e7ac 100644
--- a/.build.ci.sh
+++ b/.build.ci.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 # This is wrapper to run the build.sh on CI
 
+buildpid=
 logfile=mylog.txt
 
 if [ "$LCG_RELEASE" = "KEY4HEP_STACK" ]; then
@@ -16,7 +17,14 @@ fi
 
 while ps -p $buildpid 2>/dev/null ; do
     sleep 60
-done
+done &
+echoer=$!
+
+trap 'kill $echoer' 0
+
+wait $buildpid
+statuspid=$?
 
 tail -n100 ${logfile}
 
+exit $statuspid
-- 
GitLab