mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Exit with a value of 1 when cd fails in the init script
Exiting with 0 when cd fails is likely to be incorrectly interpreted as success so we should exit with a non-zero value. Ideally, the init script status action would exit with 4 but, at the point when the cd is performed, we don’t even know if we’re running as an init script. Exiting with 1 seems to be a reasonable compromise as it’s fine for the non init-script case as well as being correct for all init script actions other than status. See gh-4653
This commit is contained in:
parent
81a4763940
commit
02e1d669df
@ -29,16 +29,16 @@ WORKING_DIR="$(pwd)"
|
||||
[[ -n "$APP_NAME" ]] && identity="$APP_NAME"
|
||||
|
||||
# Follow symlinks to find the real jar and detect init.d script
|
||||
cd "$(dirname "$0")" || exit
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
[[ -z "$jarfile" ]] && jarfile=$(pwd)/$(basename "$0")
|
||||
while [[ -L "$jarfile" ]]; do
|
||||
[[ "$jarfile" =~ init\.d ]] && init_script=$(basename "$jarfile")
|
||||
jarfile=$(readlink "$jarfile")
|
||||
cd "$(dirname "$jarfile")" || exit
|
||||
cd "$(dirname "$jarfile")" || exit 1
|
||||
jarfile=$(pwd)/$(basename "$jarfile")
|
||||
done
|
||||
jarfolder="$(dirname "$jarfile")"
|
||||
cd "$WORKING_DIR" || exit
|
||||
cd "$WORKING_DIR" || exit 1
|
||||
|
||||
# Source any config file
|
||||
configfile="$(basename "${jarfile%.*}.conf")"
|
||||
|
Loading…
Reference in New Issue
Block a user