Commit d6ba2a8b authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'ImproveShellScriptsChangeDirException' into 'master'

Execute `exit 1` when shell script `cd` fails

See merge request gitlab-org/gitlab!46122
parents 7cbe1bf0 95c8007e
#!/usr/bin/env bash #!/usr/bin/env bash
cd $(dirname $0)/.. cd $(dirname $0)/.. || exit 1
if [ -n "$SIDEKIQ_WORKERS" ] ; then if [ -n "$SIDEKIQ_WORKERS" ] ; then
exec bin/background_jobs_sk_cluster "$@" exec bin/background_jobs_sk_cluster "$@"
......
#!/bin/sh #!/bin/sh
cd $(dirname $0)/.. cd $(dirname $0)/.. || exit 1
app_root=$(pwd) app_root=$(pwd)
mail_room_pidfile="$app_root/tmp/pids/mail_room.pid" mail_room_pidfile="$app_root/tmp/pids/mail_room.pid"
......
#!/bin/sh #!/bin/sh
cd $(dirname $0)/.. cd $(dirname $0)/.. || exit 1
app_root=$(pwd) app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid" unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
......
---
title: Execute `exit 1` when shell script `cd` fails
merge_request: 46122
author: Peter Dave Hello
type: other
#!/usr/bin/env bash #!/usr/bin/env bash
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.." || exit 1
echo "=> Linting documents at path $(pwd) as $(whoami)..." echo "=> Linting documents at path $(pwd) as $(whoami)..."
echo echo
ERRORCODE=0 ERRORCODE=0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment