Skip to content

Commit c25709c

Browse files
committed
Try handling Cygwin bash
1 parent 937b8a3 commit c25709c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

rewatch/tests/utils.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ pwd_prefix() {
1616
if is_windows; then
1717
# On Windows, escape backslashes for sed and convert to forward slashes for consistent snapshots
1818
# This ensures paths like C:\a\b are replaced correctly
19-
# First get the Windows-style path with backslashes
20-
local win_path=$(pwd -W | sed "s#/#\\\\#g")
21-
# Then escape the backslashes for sed replacement
22-
echo $win_path | sed 's#\\#\\\\#g'
19+
if [[ "$(uname -s)" =~ MINGW ]]; then
20+
# First get the Windows-style path with backslashes
21+
local win_path=$(pwd -W | sed "s#/#\\\\#g")
22+
# Then escape the backslashes for sed replacement
23+
echo $win_path | sed 's#\\#\\\\#g'
24+
else
25+
# Cygwin fallback: use cygpath for Windows style paths
26+
cygpath -w "$(pwd)" | sed 's#\\\\#\\\\\\\\#g'
27+
fi
2328
else
2429
# On Unix-like systems, escape forward slashes for sed
2530
echo $(pwd | sed "s#/#\\/#g")

0 commit comments

Comments
 (0)