class HashiCorp::VagrantVMwareDesktop::Action::WaitForVMXHalt

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

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb, line 10
def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::wait_for_vmx_halt")
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-vmware-desktop/action/wait_for_vmx_halt.rb, line 15
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