2222
2323ARGS=(" $@ " )
2424
25- set -eo pipefail {0}
26-
2725# # If EX_DOC is not set to a file, we search the PATH for it using command -v
2826if [ ! -f " ${EX_DOC} " ]; then
2927 EX_DOC=$( command -v ex_doc || true)
5149# # This is currently used to handle search engine changes in v0.39.0
5250export EX_DOC_VERSION=$( $EX_DOC --version)
5351
54- # # The below bash magic captures the output of stderr into OUTPUT while still printing
55- # # everything we get to stdout and stderr. This is done by:
56-
57- # # 1. duplicating the stdout (1) and stderr (2) streams to fd 3 and 4 respectively.
58- exec 3>&1 4>&2
59-
60- # # Running the command where we redirect stderr to fd 1 and stdout to fd 3.
61- # # We then use tee on the stderr (which is now fd 1) to print that to fd 4
62- OUTPUT=" $( { escript@EXEEXT@ " ${EX_DOC} " " ${ARGS[@]} " ; } 2>&1 1>&3 | tee /dev/fd/4 ) "
63-
64- # # Close fd 3 and 4
65- exec 3>& - 4>& -
66-
6752# # If EX_DOC_WARNINGS_AS_ERRORS is not explicitly turned on
6853# # and any .app file is missing, we turn off warnings as errors
6954if [ " ${EX_DOC_WARNINGS_AS_ERRORS} " != " true" ]; then
@@ -74,13 +59,12 @@ if [ "${EX_DOC_WARNINGS_AS_ERRORS}" != "true" ]; then
7459 done
7560fi
7661
77- if [ " ${EX_DOC_WARNINGS_AS_ERRORS} " != " false" ]; then
78- if echo " ${OUTPUT} " | grep " warning:" 1> /dev/null; then
79- echo " ex_doc emitted warnings"
80- # # Touch the config file in order to re-trigger make
81- if [ -f " docs.exs" ]; then
82- touch " docs.exs"
83- fi
84- exit 1;
62+ escript@EXEEXT@ " ${EX_DOC} " " ${ARGS[@]} "
63+
64+ if [ " $? " != " 0" ]; then
65+ # # Touch the config file in order to re-trigger make
66+ if [ -f " docs.exs" ]; then
67+ touch " docs.exs"
8568 fi
69+ exit 1;
8670fi
0 commit comments