From 1854337eb19638a0934b84ed482d218d88c62f02 Mon Sep 17 00:00:00 2001
From: Matt Clay <matt@mystile.com>
Date: Fri, 23 Sep 2016 15:09:32 -0700
Subject: [PATCH] Fix handling of ansible-doc errors. (#4992)

---
 lib/ansible/modules/test/utils/shippable/docs.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/ansible/modules/test/utils/shippable/docs.sh b/lib/ansible/modules/test/utils/shippable/docs.sh
index 9b5a6164f64..2858f87c997 100755
--- a/lib/ansible/modules/test/utils/shippable/docs.sh
+++ b/lib/ansible/modules/test/utils/shippable/docs.sh
@@ -42,10 +42,12 @@ pip list
 
 source hacking/env-setup
 
+docs_status=0
+
 PAGER=/bin/cat \
     ANSIBLE_DEPRECATION_WARNINGS=false \
     bin/ansible-doc -l \
-    2>/tmp/ansible-doc.err
+    2>/tmp/ansible-doc.err || docs_status=$?
 
 if [ -s /tmp/ansible-doc.err ]; then
     # report warnings as errors
@@ -53,3 +55,8 @@ if [ -s /tmp/ansible-doc.err ]; then
     cat /tmp/ansible-doc.err
     exit 1
 fi
+
+if [ "${docs_status}" -ne 0 ]; then
+    echo "Running 'ansible-doc -l' failed with no output on stderr and exit code: ${docs_status}"
+    exit 1
+fi