Skip to content

Commit 3507083

Browse files
brought back the old symlink resolving logic, works better
1 parent be43ba8 commit 3507083

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/vendor/
22
.idea/
3-
nohup.out
3+
*nohup.out

bin/download-binaries.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env bash
2-
DIR=$(dirname $(readlink -f "$0"))
3-
cd $DIR;
2+
source="${BASH_SOURCE[0]}"
3+
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
5+
source="$(readlink "$source")"
6+
[[ $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
7+
done
8+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
9+
cd $dir;
410
set -e
511
set -u
612
set -o pipefail
@@ -22,7 +28,7 @@ currentChromedriverVersionFile=current_chromedriver_version.txt
2228
firefoxdriverVersion=0.15.0
2329
firefoxdriverFile=geckodriver
2430

25-
cd $DIR/../binaries/
31+
cd $dir/../binaries/
2632
if [[ $? != 0 ]]
2733
then
2834
echo "Failed cd-ing into the the binaries folder, aborting"

bin/selenium-background-run.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#!/usr/bin/env bash
2-
DIR=$(dirname $(readlink -f "$0"))
3-
cd $DIR
2+
source="${BASH_SOURCE[0]}"
3+
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
5+
source="$(readlink "$source")"
6+
[[ $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
7+
done
8+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
9+
cd $dir;
410

511
source ./download-binaries.bash
612

713
echo '' > nohup.out
814
echo "
915
Starting Selenium in the Background
1016
"
11-
nohup $DIR/selenium-run.bash "$@" &
17+
nohup $dir/selenium-run.bash "$@" &
1218

1319
sleep 2
1420

bin/selenium-run.bash

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env bash
2-
DIR=$(dirname $(readlink -f "$0"))
3-
cd $DIR;
2+
source="${BASH_SOURCE[0]}"
3+
while [ -h "$source" ]; do # resolve $SOURCE until the file is no longer a symlink
4+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
5+
source="$(readlink "$source")"
6+
[[ $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
7+
done
8+
dir="$( cd -P "$( dirname "$source" )" && pwd )"
9+
cd $dir;
410
set -e
511
set -u
612
set -o pipefail
@@ -57,7 +63,7 @@ fi
5763
echo "Now Starting Selenium"
5864

5965
echo "Killing if already running:"
60-
bash $DIR/selenium-stop.bash
66+
bash $dir/selenium-stop.bash
6167

6268

6369
if [[ "$@" =~ .*firefox.* ]]

0 commit comments

Comments
 (0)