refactor: standardize on shorthand for redirecting all output to /dev/null

The shorthand is more prevalent in this codebase, and is something that bash supports, so we should just use the same thing everywhere.

Note that we do not use shorthand redirect in Makefile as shell parsing is a bit different in Make and the shorthand redirect doesn't seem to be properly supported, causing CI errors.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-01 03:48:45 -04:00
parent dac566e75e
commit ef25a9b0d8
20 changed files with 30 additions and 30 deletions

View File

@@ -48,7 +48,7 @@ trigger-scheduler-docker-local-core-post-deploy() {
if [[ "$PREVIOUS_CONTAINER_STATUS" != "dead" ]]; then
local CONTAINER_DATE_NAME="$NAME.$(date +%s)"
dokku_log_verbose_quiet "Renaming container ($cid) ${NAME} to $CONTAINER_DATE_NAME"
"$DOCKER_BIN" container rename "$NAME" "$CONTAINER_DATE_NAME" >/dev/null 2>&1 || dokku_log_warn "Unable to rename container"
"$DOCKER_BIN" container rename "$NAME" "$CONTAINER_DATE_NAME" &>/dev/null || dokku_log_warn "Unable to rename container"
fi
done
fi

View File

@@ -81,7 +81,7 @@ fn-scheduler-docker-local-retire-container() {
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
if [[ "$STATE" == "restarting" ]]; then
"$DOCKER_BIN" container update --restart=no "$CID" >/dev/null 2>&1
"$DOCKER_BIN" container update --restart=no "$CID" &>/dev/null
fi
if [[ "$STATE" != "dead" ]] && [[ "$STATE" != "exited" ]]; then
@@ -142,8 +142,8 @@ fn-scheduler-docker-local-retire-containers() {
continue
fi
"$DOCKER_BIN" container rm --force "$CID" >/dev/null 2>&1 || true
if "$DOCKER_BIN" container inspect "${CID}" >/dev/null 2>&1; then
"$DOCKER_BIN" container rm --force "$CID" &>/dev/null || true
if "$DOCKER_BIN" container inspect "${CID}" &>/dev/null; then
dokku_log_warn "Container ${CID} still running"
continue
fi

View File

@@ -79,7 +79,7 @@ trigger-scheduler-docker-local-scheduler-deploy() {
trap '' INT HUP
sleep "$DOKKU_WAIT_TO_RETIRE"
for oldid in $oldids; do
if ! docker container inspect "$oldid" >/dev/null 2>&1; then
if ! docker container inspect "$oldid" &>/dev/null; then
continue
fi
# Disable the container restart policy

View File

@@ -24,7 +24,7 @@ trigger-scheduler-docker-local-scheduler-logs-failed() {
while read -r LINE || [[ -n "$LINE" ]]; do
CID="$(echo "$LINE" | cut -d ' ' -f1)"
PREFIX="$(echo "$LINE" | cut -d ' ' -f2)"
if "$DOCKER_BIN" container inspect "${CID}" >/dev/null 2>&1; then
if "$DOCKER_BIN" container inspect "${CID}" &>/dev/null; then
RUNNING_CONTAINERS+=("$CID")
else
DEAD_CONTAINERS+=("$CID")

View File

@@ -33,7 +33,7 @@ trigger-scheduler-docker-local-scheduler-stop() {
plugn trigger scheduler-register-retired "$APP" "$CID"
done
"$DOCKER_BIN" container rm --force $DOKKU_APP_CIDS >/dev/null 2>&1 || true
"$DOCKER_BIN" container rm --force $DOKKU_APP_CIDS &>/dev/null || true
fi
fi
}