[libvirt] [cim PATCH 1/3] autogen: Better error handling

Andrea Bolognani abologna at redhat.com
Thu Nov 16 17:12:54 UTC 2017


Instead of making the execution of each command dependend on the
success of the previous one, check return values explicitly.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 autogen.sh | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index e4b7adc..5b2e4dc 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,20 +2,26 @@
 # ============================================================================
 # (C) Copyright IBM Corp. 2005
 
-echo "Running libtool ..." &&
-libtoolize --copy --force --automake &&
+die()
+{
+    test "$1" && echo "$1" >&2
+    exit 1
+}
 
-echo "Running aclocal ..." &&
-aclocal --force &&
+echo "Running libtool ..."
+libtoolize --copy --force --automake || die
 
-echo "Running autoheader ..." &&
-autoheader --force &&
+echo "Running aclocal ..."
+aclocal --force || die
 
-echo "Running automake ..." &&
-automake -i --add-missing --copy --foreign &&
+echo "Running autoheader ..."
+autoheader --force || die
 
-echo "Running autoconf ..." &&
-autoconf --force &&
+echo "Running automake ..."
+automake -i --add-missing --copy --foreign || die
+
+echo "Running autoconf ..."
+autoconf --force || die
 
 if test -x $(which git); then
     git rev-parse --short HEAD > .changeset
-- 
2.14.3




More information about the libvir-list mailing list