core: cygwin_path only uses cygpath in cygwin [GH-3804]

This commit is contained in:
Mitchell Hashimoto 2014-05-17 12:07:43 -07:00
parent 34b7cace7b
commit 6353c765ae
2 changed files with 18 additions and 13 deletions

View File

@ -17,6 +17,8 @@ BUG FIXES:
and exit status behind. [GH-3729]
- synced\_folders/rsync: `rsync__chown` can be set to `false` to
disable recursive chown after sync. [GH-3810]
- synced\_folders/rsync: Use a proper msys path if not in
Cygwin. [GH-3804]
## 1.6.2 (May 12, 2014)

View File

@ -57,20 +57,23 @@ module Vagrant
# @param [String] path
# @return [String]
def cygwin_path(path)
begin
# First try the real cygpath
process = Subprocess.execute("cygpath", "-u", "-a", path.to_s)
return process.stdout.chomp
rescue Errors::CommandUnavailableWindows
# Sometimes cygpath isn't available (msys). Instead, do what we
# can with bash tricks.
process = Subprocess.execute(
"bash",
"--noprofile",
"--norc",
"-c", "cd #{Shellwords.escape(path)} && pwd")
return process.stdout.chomp
if cygwin?
begin
# First try the real cygpath
process = Subprocess.execute("cygpath", "-u", "-a", path.to_s)
return process.stdout.chomp
rescue Errors::CommandUnavailableWindows
end
end
# Sometimes cygpath isn't available (msys). Instead, do what we
# can with bash tricks.
process = Subprocess.execute(
"bash",
"--noprofile",
"--norc",
"-c", "cd #{Shellwords.escape(path)} && pwd")
return process.stdout.chomp
end
# This takes any path and converts it to a full-length Windows