Class: VagrantPlugins::GuestWindows::Cap::Reboot

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-guest-msys2/cap/reboot.rb

Class Method Summary collapse

Class Method Details

.wait_for_reboot(machine) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/vagrant-guest-msys2/cap/reboot.rb', line 5

def self.wait_for_reboot(machine)
  return if machine.config.vm.communicator != :ssh
  
  script  = File.expand_path("../../scripts/reboot_detect.ps1", __FILE__)
  script  = File.read(script)
  while machine.communicate.execute(script, error_check: false) != 0
    sleep 10
  end

  # This re-establishes our symbolic links if they were
  # created between now and a reboot
  machine.communicate.execute("net use", error_check: false)
end