Skip to content

Commit 6ee4a31

Browse files
committed
fix: Remove wsl path prefix when running tphp
1 parent c9f26c8 commit 6ee4a31

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bin/tphp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ if [[ "$1" == "debug" ]]; then
1818
fi
1919

2020
# Replace local path with remote path in any file path arguments
21-
# e.g. /User/me/totara-sites/mysite/server/plugin/test.php -> /var/www/totara/src/mysite/server/plugin/test.php
21+
# e.g. //wsl.localhost/Ubuntu/home/me/totara-sites/mysite/server/plugin/test.php -> /var/www/totara/src/mysite/server/plugin/test.php
2222
args=()
2323
for arg in "$@"; do
24-
if [[ "$arg" == "$LOCAL_SRC"* && -e "$arg" ]]; then
25-
arg="$REMOTE_SRC${arg#$LOCAL_SRC}"
24+
if [[ "$arg" == *"$LOCAL_SRC"* ]]; then
25+
arg="$REMOTE_SRC${arg#*$LOCAL_SRC}"
26+
# Strip any unescaped single quote characters
27+
arg=$(echo "$arg" | sed "s/\([^']\)'\([^']\)/\1\2/g; s/^'//; s/'$//")
2628
fi
2729
args+=("$arg")
2830
done

0 commit comments

Comments
 (0)