diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2020-11-11 21:20:20 +0100 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2021-03-01 20:18:04 +0100 |
commit | b2b3c91ed7fb44e6c6bc2f6984615b1635a5db03 (patch) | |
tree | 993625288787b3ee7c00cafe03a269ab2a2b9991 /tests | |
parent | 24f850f4a49ffd1638f4bfb8b594d8f0bc34ced2 (diff) | |
download | curl-b2b3c91ed7fb44e6c6bc2f6984615b1635a5db03.tar.gz |
pathhelp.pm: fix use of pwd -L in Msys environment
While Msys2 has a pwd binary which supports -L,
Msys1 only has a shell built-in with that feature.
Reviewed-by: Jay Satiro
Part of #6179
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pathhelp.pm | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm index f3bdc5bdf..0603d509d 100644 --- a/tests/pathhelp.pm +++ b/tests/pathhelp.pm @@ -372,7 +372,15 @@ sub sys_native_abs_path { # Path is in relative form. Resolve relative directories in Unix form # *BEFORE* converting to Win32 form otherwise paths like # '../../../cygdrive/c/windows' will not be resolved. - my $cur_dir = `pwd -L`; + + my $cur_dir; + # MSys shell has built-in command. + if($^O eq 'msys') { + $cur_dir = `bash -c 'pwd -L'`; + } + else { + $cur_dir = `pwd -L`; + } if($? != 0) { warn "Can't determine current working directory.\n"; return undef; @@ -440,7 +448,13 @@ sub build_sys_abs_path { # Path is empty string. Return current directory. # Empty string processed correctly by 'cygpath'. - chomp($path = `pwd -L`); + # MSys shell has built-in command. + if($^O eq 'msys') { + chomp($path = `bash -c 'pwd -L'`); + } + else { + chomp($path = `pwd -L`); + } if($? != 0) { warn "Can't determine Unix-style current working directory.\n"; return undef; @@ -510,7 +524,15 @@ sub build_sys_abs_path { # Path in relative form. Resolve relative directories in Unix form # *BEFORE* converting to Win32 form otherwise paths like # '../../../cygdrive/c/windows' will not be resolved. - my $cur_dir = `pwd -L`; + + my $cur_dir; + # MSys shell has built-in command. + if($^O eq 'msys') { + $cur_dir = `bash -c 'pwd -L'`; + } + else { + $cur_dir = `pwd -L`; + } if($? != 0) { warn "Can't determine current working directory.\n"; return undef; |