Skip to content

Commit bf87a38

Browse files
committed
Fixed bench CLI wrapper to resolve real script path with bash
1 parent d8e47cc commit bf87a38

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bench

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# bench: CLI wrapper for the benchmarking tool
33

4-
# Get the directory where this script is located
5-
DIR="$(cd "$(dirname "$0")" && pwd)"
4+
# Resolve the real path of the script, following symlinks
5+
SOURCE="${BASH_SOURCE[0]:-$0}"
6+
while [ -h "$SOURCE" ]; do
7+
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
8+
SOURCE="$(readlink "$SOURCE")"
9+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
10+
done
11+
DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
612

713
# Activate the virtual environment
814
. "$DIR/venv/bin/activate"
915

10-
# Run the benchmark (pass along any CLI args)
11-
python "$DIR/main.py" "$@"
16+
# Run the benchmark
17+
python "$DIR/main.py" "$@"

0 commit comments

Comments
 (0)