Skip to content

Commit

Permalink
synced_folder: search in more places for cygwin executables
Browse files Browse the repository at this point in the history
When running from DOS prompt on windows we can't find ssh or
sftp-server executables even if cygwin is on the system and the
executables exist. We added some common locations where cygwin
is installed to search for these executables.
  • Loading branch information
dustymabe committed Jun 16, 2016
1 parent 2a118f6 commit f16f8e3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/vagrant-sshfs/synced_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,22 @@ def find_executable(name)

# Try to include paths where sftp-server may live so
# That we have a good chance of finding it
if Vagrant::Util::Platform.windows? and
Vagrant::Util::Platform.cygwin?
cygwin_root = Vagrant::Util::Platform.cygwin_windows_path('/')
ENV['PATH'] += ';' + cygwin_root + '\usr\sbin'
if Vagrant::Util::Platform.windows?
if Vagrant::Util::Platform.cygwin?
# If in a cygwin terminal then we can programmatically
# determine where sftp-server would be. ssh should already
# be in path.
cygwin_root = Vagrant::Util::Platform.cygwin_windows_path('/')
ENV['PATH'] += ';' + cygwin_root + '\usr\sbin'
else
# If not in a cygwin terminal then we'll have to guess
# where cygwin is installed and add the /bin/ (for ssh) and
# /usr/sbin (for sftp-server) to the PATH.
ENV['PATH'] += ';C:\cygwin\bin'
ENV['PATH'] += ';C:\cygwin\usr\sbin'
ENV['PATH'] += ';C:\cygwin64\bin'
ENV['PATH'] += ';C:\cygwin64\usr\sbin'
end
else
ENV['PATH'] += ':/usr/libexec/openssh' # Linux (Red Hat Family)
ENV['PATH'] += ':/usr/lib/openssh' # Linux (Debian Family)
Expand Down

0 comments on commit f16f8e3

Please sign in to comment.