diff options
author | Andrew Dunstan | 2021-07-29 16:15:03 +0000 |
---|---|---|
committer | Andrew Dunstan | 2021-07-29 16:15:03 +0000 |
commit | bad106752272c05de5a56036b8a84ae6ff3249a0 (patch) | |
tree | f8d8f97c973e0e89535843f6d8e21c7ce57d8057 | |
parent | 91f9861242cd7dcf28fae216b1d8b47551c9159d (diff) |
Make TestLib::perl2host more consistent and robust
Sometimes cygpath has been observed to return a path with a trailing
slash. That can cause problems, Also, make "cygpath" usage
consistent with "pwd -W" with respect to the use of forward slashes.
Backpatch to release 14 where the current code was introduced.
-rw-r--r-- | src/test/perl/TestLib.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 15572abbea4..cbab1587cc2 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -304,6 +304,8 @@ except for the case of Perl=msys and host=mingw32. The subject need not exist, but its parent or grandparent directory must exist unless cygpath is available. +The returned path uses forward slashes but has no trailing slash. + =cut sub perl2host @@ -313,10 +315,11 @@ sub perl2host if ($is_msys2) { # get absolute, windows type path - my $path = qx{cygpath -a -w "$subject"}; + my $path = qx{cygpath -a -m "$subject"}; if (!$?) { chomp $path; + $path =~ s!/$!!; return $path if $path; } # fall through if this didn't work. @@ -342,6 +345,7 @@ sub perl2host # this odd way of calling 'pwd -W' is the only way that seems to work. my $dir = qx{sh -c "pwd -W"}; chomp $dir; + $dir =~ s!/$!!; chdir $here; return $dir . $leaf; } |