Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if argument is a java system property or an argument for the se… #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions bin/selenium-server-standalone
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#see http://stackoverflow.com/questions/7665/how-to-resolve-symbolic-links-in-a-shell-script
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
Expand All @@ -8,4 +8,22 @@ while [ -h "$SELF_PATH" ]; do
SELF_PATH=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

exec java -jar "${SELF_PATH}.jar" "$@"
#check if argument is a java system property or an argument for the selenium server, see issue #17
#see https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash/14203146#14203146
ARGS=()
JAVASYTEMPROPERTIES=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
"-D"* ) #java system property has to be placed before the -jar argument
JAVASYTEMPROPERTIES+=("$1")
;;
*) #other arguments have to be put after the -jar
ARGS+=("$1")
;;
esac
shift
done

exec java "${JAVASYTEMPROPERTIES[@]}" -jar "${SELF_PATH}.jar" "${ARGS[@]}"