From 25caae3d8048959c9cb6b0ee63460037ff04c5c0 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Wed, 16 Feb 2022 13:49:55 +0100
Subject: [PATCH] Make sure we receive the proper exit code from docker
 exec/run commands inside scripts

---
 bin/backstop       | 3 +++
 bin/docker-compose | 3 +++
 bin/drush          | 3 +++
 bin/node_cmd       | 5 +++++
 bin/phpstan        | 3 +++
 bin/rector         | 3 +++
 6 files changed, 20 insertions(+)

diff --git a/bin/backstop b/bin/backstop
index 9ceef1e..e42eec0 100755
--- a/bin/backstop
+++ b/bin/backstop
@@ -3,3 +3,6 @@
 export $(cat .env | xargs)
 cd tests/backstop
 docker run --rm -t -v $(php /usr/local/bin/volume.php) -w $PWD --network=traefik_${COMPOSE_PROJECT_NAME} backstopjs/backstopjs "$@"
+EC=$?
+
+exit $EC
diff --git a/bin/docker-compose b/bin/docker-compose
index 9efcf2e..19297e9 100755
--- a/bin/docker-compose
+++ b/bin/docker-compose
@@ -1,3 +1,6 @@
 #!/bin/bash
 
 docker compose "$@"
+EC=$?
+
+exit $EC
diff --git a/bin/drush b/bin/drush
index 5321975..a945acc 100755
--- a/bin/drush
+++ b/bin/drush
@@ -5,6 +5,7 @@ function setPermissions {
 }
 
 docker compose exec ${LAKEDROPS_DEV_DC_OPTIONS} php drush "$@"
+EC=$?
 
 if [[ "$1" == "gen" ]]; then
   setPermissions
@@ -12,3 +13,5 @@ fi
 if [[ "$1" == "generate" ]]; then
   setPermissions
 fi
+
+exit $EC
diff --git a/bin/node_cmd b/bin/node_cmd
index 69d8e11..66cd789 100755
--- a/bin/node_cmd
+++ b/bin/node_cmd
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 if [[ -z "$NODE_VERSION" ]]; then
   NODE_VERSION=12-stretch-slim
 fi
@@ -40,3 +42,6 @@ else
     registry.lakedrops.com/docker/node:${NODE_VERSION} >/dev/null
 fi
 docker exec -it -w ${PWD} ${NAME} ${NODE_CMD} "$@"
+EC=$?
+
+exit $EC
diff --git a/bin/phpstan b/bin/phpstan
index 2680707..7df2343 100755
--- a/bin/phpstan
+++ b/bin/phpstan
@@ -2,3 +2,6 @@
 
 export $(cat .env | xargs)
 docker run --rm -v $(php /usr/local/bin/volume.php /app) phpstan/phpstan "$@"
+EC=$?
+
+exit $EC
diff --git a/bin/rector b/bin/rector
index 8353ee6..0196210 100755
--- a/bin/rector
+++ b/bin/rector
@@ -1,3 +1,6 @@
 #!/bin/bash
 
 docker compose exec ${LAKEDROPS_DEV_DC_OPTIONS} php /var/www/html/vendor/bin/rector "$@"
+EC=$?
+
+exit $EC
-- 
GitLab