Class: HashiCorp::VagrantVMwareDesktop::Action::WaitForVMXHalt

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb

Overview

This waits for the actual “vmx” process to finish running.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ WaitForVMXHalt

Returns a new instance of WaitForVMXHalt.



13
14
15
16
# File 'lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb', line 13

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::wait_for_vmx_halt")
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb', line 18

def call(env)
  @logger.info("Waiting for VMX process to go away...")
  if env[:machine].provider.driver.vmx_alive?
    env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.waiting_for_vmx_halt"))

    60.times do |i|
      if !env[:machine].provider.driver.vmx_alive?
        @logger.info("VMX process went away!")
        break
      end

      sleep 1
    end
  end

  @app.call(env)
end