@@ -4,6 +4,7 @@ if [[ "$1" == "-h"* ]] || [[ "$1" == "--h"* ]]; then
44 echo " Usage: $0 {arguments to the real 'make'}"
55 echo " Runs 'make' in the boilerplate backing container."
66 echo " If the command fails, starts a shell in the container so you can debug."
7+ echo " Set NONINTERACTIVE=true (or TRUE) to skip the debug shell and exit with the make return code."
78 exit -1
89fi
910
@@ -40,12 +41,20 @@ banner "Running: make $@"
4041$CONTAINER_ENGINE $args make " $@ "
4142rc=$?
4243
43- # If it failed, drop into the container in a shell
44+ # If it failed, check if we should drop into a shell or exit
4445if [[ $rc -ne 0 ]]; then
45- banner " The 'make' command failed! Starting a shell in the container for debugging. Just 'exit' when done."
46- $CONTAINER_ENGINE $args /bin/bash
46+ # Case-insensitive check for NONINTERACTIVE (true, TRUE, True all work)
47+ if [[ " ${NONINTERACTIVE,,} " == " true" ]]; then
48+ banner " The 'make' command failed with exit code $rc . Skipping debug shell (NONINTERACTIVE=${NONINTERACTIVE} )."
49+ else
50+ banner " The 'make' command failed! Starting a shell in the container for debugging. Just 'exit' when done."
51+ $CONTAINER_ENGINE $args /bin/bash
52+ fi
4753fi
4854
4955# Finally, remove the container
5056banner " Cleaning up the container"
5157$CONTAINER_ENGINE rm -f $container_id > /dev/null
58+
59+ # Exit with the return code from make
60+ exit $rc
0 commit comments