Skip to content

Commit

Permalink
brought back the old symlink resolving logic, works better
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondscommerce committed Mar 8, 2018
1 parent be43ba8 commit 3507083
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/vendor/
.idea/
nohup.out
*nohup.out
12 changes: 9 additions & 3 deletions bin/download-binaries.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
DIR=$(dirname $(readlink -f "$0"))
cd $DIR;
source="${BASH_SOURCE[0]}"
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
dir="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
[[ $source != /* ]] && source="$dir/$source" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
dir="$( cd -P "$( dirname "$source" )" && pwd )"
cd $dir;
set -e
set -u
set -o pipefail
Expand All @@ -22,7 +28,7 @@ currentChromedriverVersionFile=current_chromedriver_version.txt
firefoxdriverVersion=0.15.0
firefoxdriverFile=geckodriver

cd $DIR/../binaries/
cd $dir/../binaries/
if [[ $? != 0 ]]
then
echo "Failed cd-ing into the the binaries folder, aborting"
Expand Down
12 changes: 9 additions & 3 deletions bin/selenium-background-run.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/usr/bin/env bash
DIR=$(dirname $(readlink -f "$0"))
cd $DIR
source="${BASH_SOURCE[0]}"
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
dir="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
[[ $source != /* ]] && source="$dir/$source" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
dir="$( cd -P "$( dirname "$source" )" && pwd )"
cd $dir;

source ./download-binaries.bash

echo '' > nohup.out
echo "
Starting Selenium in the Background
"
nohup $DIR/selenium-run.bash "$@" &
nohup $dir/selenium-run.bash "$@" &

sleep 2

Expand Down
12 changes: 9 additions & 3 deletions bin/selenium-run.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash
DIR=$(dirname $(readlink -f "$0"))
cd $DIR;
source="${BASH_SOURCE[0]}"
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
dir="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
[[ $source != /* ]] && source="$dir/$source" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
dir="$( cd -P "$( dirname "$source" )" && pwd )"
cd $dir;
set -e
set -u
set -o pipefail
Expand Down Expand Up @@ -57,7 +63,7 @@ fi
echo "Now Starting Selenium"

echo "Killing if already running:"
bash $DIR/selenium-stop.bash
bash $dir/selenium-stop.bash


if [[ "$@" =~ .*firefox.* ]]
Expand Down

0 comments on commit 3507083

Please sign in to comment.