From b2e0a95a111ebe24e890993fb6fd64221afd2192 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 6 Jul 2021 10:53:08 +0200 Subject: [PATCH] Override ARGS and fail correctly See https://github.com/Coop-Cloud/peertube/issues/1. --- abra | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/abra b/abra index 3a8de81..68f9c87 100755 --- a/abra +++ b/abra @@ -1841,10 +1841,12 @@ sub_app_run(){ RUN_USER="-u $abra___user" fi + local -a ARGS="${ARGS:-""}" + if [ "$abra___no_tty" = "true" ]; then - ARGS="-i" + ARGS+=" -i" else - ARGS="-it" + ARGS+=" -it" fi CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \ @@ -1856,11 +1858,12 @@ sub_app_run(){ fi debug "Using container ID ${CONTAINER}" + debug "Running command: docker exec $RUN_USER "$ARGS" "$CONTAINER" "$@"" - # 3wc: we want the "splitting" that shellcheck warns us about, so that -u and - # $RUN_USER aren't treated as a single argument: # shellcheck disable=SC2086 - docker exec $RUN_USER $ARGS "$CONTAINER" "$@" + if ! docker exec $RUN_USER "$ARGS" "$CONTAINER" "$@"; then + exit 1 + fi return }